Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to hook into the trash post function in the bulk menu.

I've managed to hook into an item when I trash it by it self by using the wp_trash_post hook, but this does not work when doing it in bulk.

Does anyone know how I can do this?

share|improve this question
2  
This is because accepts only 1 parameter i.e the post id codex.wordpress.org/Function_Reference/wp_trash_post Can I know what exactly you are trying to do? Also provide some code. –  Chittaranjan Dec 7 '13 at 14:36
    
Ok, what I am trying to do is delete an associated post (product post type) when my custom post type (video) is deleted and vice versa. This works when I delete a video post by itself but not when using the bulk delete. I have actually disabled the trash, so only deleting happens, but I asked this question with the wp_trash_post as it also will not work. –  Peter Dec 10 '13 at 5:30
    
add_action('before_delete_post', 'delete_post_from_video'); function delete_post_from_video() { global $post; global $wpdb; if ($post->post_type == 'video') { $check_attached_product = get_post_meta($post->ID, 'attached_product', true); if ($check_attached_product != "") { delete_post_meta($post->ID, 'attached_product', $check_attached_product); wp_delete_post( $check_attached_product ); } } –  Peter Dec 11 '13 at 1:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.