_update_blog_date_on_post_publish

Handler for updating the blog date when a post is published or an already published post is changed.

Description

_update_blog_date_on_post_publish( (string) $new_status, (string) $old_status, (object) $post ); 

Parameters (3)

0. $new_status (string)
The new post status
1. $old_status (string)
The old post status
2. $post (object)
Post object

Usage

  1. if ( !function_exists( '_update_blog_date_on_post_publish' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-blogs.php'; 
  3.  
  4. // The new post status 
  5. $new_status = ''; 
  6.  
  7. // The old post status 
  8. $old_status = ''; 
  9.  
  10. // Post object 
  11. $post = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = _update_blog_date_on_post_publish($new_status, $old_status, $post); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-blogs.php  
  1. function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) { 
  2. $post_type_obj = get_post_type_object( $post->post_type ); 
  3. if ( ! $post_type_obj || ! $post_type_obj->public ) { 
  4. return; 
  5.  
  6. if ( 'publish' != $new_status && 'publish' != $old_status ) { 
  7. return; 
  8.  
  9. // Post was freshly published, published post was saved, or published post was unpublished. 
  10.