WordPress.org

Make WordPress Core

Changeset 21942


Ignore:
Timestamp:
09/21/2012 06:49:45 PM (6 years ago)
Author:
nacin
Message:

Have wp_publish_post() wrap wp_insert_post() directly. see #11399.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r21922 r21942  
    28572857 *
    28582858 * @since 2.1.0
    2859  * @uses $wpdb
    2860  * @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data.
    2861  *
    2862  * @param int $post_id Post ID.
    2863  * @return null
    2864  */
    2865 function wp_publish_post($post_id) {
    2866     global $wpdb;
    2867 
    2868     $post = get_post($post_id);
    2869 
    2870     if ( empty($post) )
     2859 * @uses wp_insert_post()
     2860 *
     2861 * @param mixed $post Post ID or object.
     2862 */
     2863function wp_publish_post( $post ) {
     2864    if ( ! $post = get_post( $post ) )
    28712865        return;
    2872 
    28732866    if ( 'publish' == $post->post_status )
    28742867        return;
    28752868
    2876     $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post_id ) );
    2877 
    2878     $old_status = $post->post_status;
    28792869    $post->post_status = 'publish';
    2880     wp_transition_post_status('publish', $old_status, $post);
    2881 
    2882     do_action('edit_post', $post_id, $post);
    2883     do_action('save_post', $post_id, $post);
    2884     do_action('wp_insert_post', $post_id, $post);
     2870    wp_insert_post( $post );
    28852871}
    28862872
Note: See TracChangeset for help on using the changeset viewer.