[wp-trac] [WordPress Trac] #5364: Cron not updated correctly when deleting a future post

WordPress Trac wp-trac at lists.automattic.com
Sat Nov 17 12:39:52 GMT 2007


#5364: Cron not updated correctly when deleting a future post
----------------------+-----------------------------------------------------
 Reporter:  develish  |       Owner:  anonymous                      
     Type:  defect    |      Status:  new                            
 Priority:  low       |   Milestone:  2.5                            
Component:  General   |     Version:  2.3.1                          
 Severity:  minor     |    Keywords:  cron delete post wp_delete_post
----------------------+-----------------------------------------------------
 Hi,

 my name is Mariano and this is my first bug report so please bear with me
 :D

 When I delete a future post using
 wp_delete_post($post->ID)
 it does not update the cron correctly.


 I use this code to actually manually delete and unschedule the future
 posts


 {{{
 $posts = $wpdb->get_results( "SELECT ID FROM $wpdb->posts where
 post_status = 'future';" );
 foreach ($posts as $post)
   {
     wp_clear_scheduled_hook( 'publish_future_post', $post->ID );
     wp_delete_post($post->ID)<
   }
 }}}



 Maybe a check if the post is of post_status future and then unscheduling
 it in the post deletion process would fix it.

 I was not able to find the unschedule in post.php -> wp_delete_post


 Thanks for consideration


 Mariano

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5364>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list