Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_transition_post_status [ WordPress Function ]

_transition_post_status ( $new_status, $old_status, $post )
Access:
  • private
Parameters:
  • (string) $new_status New post status
  • (string) $old_status Previous post status
  • (object) $post Object type containing the post information
Uses:
Defined at:



Hook for managing future post transitions to published.

Source


<?php
function _transition_post_status($new_status$old_status$post) {
    global 
$wpdb;

    if ( 
$old_status != 'publish' && $new_status == 'publish' ) {
        
// Reset GUID if transitioning to publish and it is empty
        
if ( '' == get_the_guid($post->ID) )
            
$wpdb->update$wpdb->posts, array( 'guid' => get_permalink$post->ID ) ), array( 'ID' => $post->ID ) );
        
do_action('private_to_published'$post->ID);  // Deprecated, use private_to_publish
    
}

    
// If published posts changed clear the lastpostmodified cache
    
if ( 'publish' == $new_status || 'publish' == $old_status) {
        foreach ( array( 
'server''gmt''blog' ) as $timezone ) {
            
wp_cache_delete"lastpostmodified:$timezone"'timeinfo' );
            
wp_cache_delete"lastpostdate:$timezone"'timeinfo' );
        }
    }

    
// Always clears the hook in case the post status bounced from future to draft.
    
wp_clear_scheduled_hook('publish_future_post', array( $post->ID ) );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics