Tell us what you are trying to do?
I need to execute a php function after a post delete button has been clicked, but before the deletion fires. There is a custom field value I need to capture and update a different post with.
Are there any hooks/actions that would allow me to do this?
Is there any documentation that you are following?
https://toolset.com/forums/topic/action-hook-fired-before-post-will-be-deleted/
This is similar, but the delete button will be on the post content template, not on a form. So I'm unsure how I would target the deletion action, as this appears to target the form submission action.
Hi there
Would the WordPress before_delete_post hook work for you?
https://developer.wordpress.org/reference/hooks/before_delete_post/
Otherwise, can you clarify exactly how you are adding the delete button to your template so we know we are targeting the right thing.
Thanks Nigel, not sure how I missed that, yes I believe that will work.
I was planning on using the cred_delete_post_link shortcode on the content template. For this use case I will need to target two different post types, containers and shipments.
Hi,
Thanks for writing back.
Feel free to try the 'before_delete_post hook' and let us know if you have any follow-up question.
For a new question or concern, you're welcome to start a new ticket.
regards,
Waqar