[wp-trac] [WordPress Trac] #22353: in function wp_publish_post, make it call the wp_update_post

WordPress Trac noreply at wordpress.org
Sat Nov 3 01:17:47 UTC 2012


#22353: in function wp_publish_post, make it call the wp_update_post
--------------------------------------+-----------------------------
 Reporter:  wordpressplugindeveloper  |       Type:  feature request
   Status:  new                       |   Priority:  normal
Milestone:  Awaiting Review           |  Component:  General
  Version:  trunk                     |   Severity:  trivial
 Keywords:                            |
--------------------------------------+-----------------------------
 If the post is submitted by role who cannot publish posts, the post will
 be pending by default and the post name will be empty.

 We have a custom posts management interface to approve pending posts.

 We use wp_publish_post to approve posts.

 Sadly, we find out the approved posts don't have post slug.

 So I just wonder will it be better if it can call wp_update_post to handle
 post status update.

 Just my 2 cents.

 Thanks for your hard work on wordpress!




 {{{
 function wp_publish_post($post_id) {
         global $wpdb;

         $post = get_post($post_id);

         if ( empty($post) )
                 return;

         if ( 'publish' == $post->post_status )
                 return;

         $old_status = $post->post_status;
         $post->post_status = 'publish';

         wp_update_post($post);

         wp_transition_post_status('publish', $old_status, $post);

         do_action('edit_post', $post_id, $post);
         do_action('save_post', $post_id, $post);
         do_action('wp_insert_post', $post_id, $post);
 }
 }}}

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


More information about the wp-trac mailing list