Custom Post Type Hooks
-
Hi, I’ve been looking through the forum and internet for a while but couldn’t really find the informations which could helo me, hope you guys can help me out.
I am looking to hook actions on publishing and deleting posts custom post type, as I know there are ways to use hooks customized to custom post type (e.g ‘publish_my-custom-post-type’).
add_action('publish_my-custom-post-type', 'my-function-on-publish');
Works well with the publish action.My problem is actually with the delete action, as :
add_action('delete_my-custom-post-type', 'my-function-on-delete');
doesn’t work, neither does:add_action('delete_post', 'my-function-on-delete'); function my-function-on-delete() { if ($post->post_type == 'my-custom-post-type') { //My function } }
I genuinely hope the solution isn’t ridiculously obvious and that I am not wasting anyone time ( I am not really a wordpress guru…) but have spent a good few hours without being able to find a solution.
Thanks a lot for any suggestion!
- The topic ‘Custom Post Type Hooks’ is closed to new replies.