wp_publish_post [ WordPress Functions ]
wp_publish_post ( $post )
| Parameters: |
|
| Uses: |
|
| Defined at: |
|
| Codex |
Publish a post by transitioning the post status.
Source
function wp_publish_post( $post ) {
global $wpdb;
if ( ! $post = get_post( $post ) )
return;
if ( 'publish' == $post->post_status )
return;
$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) );
clean_post_cache( $post->ID );
$old_status = $post->post_status;
$post->post_status = 'publish';
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 );
}Examples [ wp-snippets.com ]
Top Google Search Results
- Function Reference/wp publish post « WordPress Codex
Description. Publish a post by transitioning the post status. Note: This function does not do anything except transition the post status. If you want to ensure ...
codex.wordpress.org - #22353 (in function wp_publish_post, make it call the ...
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 ...
core.trac.wordpress.org - wp_publish_post (WordPress Function) - WPSeek.com
Jun 9, 2013 ... Publish a post by transitioning the post status. WordPress lookup for wp_publish_post, a WordPress Function.
wpseek.com - wp_publish_post | A HitchHackers guide through WordPress
Feb 12, 2011 ... function wp_publish_post($post_id) { global $wpdb; $post = get_post($post_id); if ( empty($post) ) return; if ( 'publish' == $post->post_status ) ...
hitchhackerguide.com
User discussions [ wordpress.org ]
- Coffee4cr on "wp_publish_post Triggering action 'publish_post'"
- Coffee4cr on "wp_publish_post Triggering action 'publish_post'"
- Tuppaloprobe on "Create custom "add new post" with predefined values for title etc."
- MichaelH on "Create custom "add new post" with predefined values for title etc."
- Tuppaloprobe on "Create custom "add new post" with predefined values for title etc."
- esmi on "Should I report this as a bug? wp_publish_post"
- granrojo on "Should I report this as a bug? wp_publish_post"
