Changeset 21942 for trunk/wp-includes/post.php
- Timestamp:
- 09/21/2012 06:49:45 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r21922 r21942 2857 2857 * 2858 2858 * @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 */ 2863 function wp_publish_post( $post ) { 2864 if ( ! $post = get_post( $post ) ) 2871 2865 return; 2872 2873 2866 if ( 'publish' == $post->post_status ) 2874 2867 return; 2875 2868 2876 $wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post_id ) );2877 2878 $old_status = $post->post_status;2879 2869 $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 ); 2885 2871 } 2886 2872
Note: See TracChangeset
for help on using the changeset viewer.