Skip Navigation

[Resolved] delete_post not firing when deleting post from cred_delete_post_link

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Nigel 6 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#597869

I am trying to execute custom code when a post is deleted. I've written a simple function using delete_post to delete a user when a user custom field matches the post ID of the post being deleted. When I delete the post from the front end using a link created from cred_delete_post_link, delete_post does not fire and the use is not deleted. If I delete the post from the back end delete_post does fire, the function works and the user is deleted.

#597976

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Keith

Firstly, please note that you are posting in the Community Forum for users of the free Types plugin. As a Toolset customer you can and should post in the Technical Support forum which we prioritise and where you should receive speedier service.

Regarding the issue, I just tested it myself and it does trigger the delete_post and deleted_post hooks.

Looking at the CRED source code the deletion happens using the standard wp_delete_post function, so it would be odd if the hooks were not triggered.

When you insert the cred_delete_post_link you specify whether the post will be trashed or deleted. Does your shortcode have the action="delete" attribute?

If the post is trashed rather than deleted the hooks won't be triggered.

#598054

Oops! Sorry for posting in the wrong forum. I will reopen this ticket in Tech Support.

#598079

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I was going to say no need, we can carry on here, but I see you opened a new ticket already, so I will close this.

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.