wp_publish_post [ WordPress Function ]
wp_publish_post ( $post_id )
| Parameters: |
|
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Publish a post by transitioning the post status.
Source
<?php
function wp_publish_post($post_id) {
global $wpdb;
$post = get_post($post_id);
if ( empty($post) )
return;
if ( 'publish' == $post->post_status )
return;
$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $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 - wp_publish_post() Does Not Set post_* : alexking.org
Sep 19, 2011 ... The inline documentation for wp_publish_post() says that it will: ... When I was initially doing this (and using wp_publish_post() instead of ...
alexking.org - wp_publish_post (WordPress Function) - WPSeek.com
WordPress lookup for wp_publish_post, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - wp_publish_post() WordPress function reference, arguments and ...
Search. Blog. wp_publish_post(). Publish a post by transitioning the post status. Signature. wp_publish_post( $post_id ). post_id: (int) Post ID. Return. (null) ...
queryposts.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"