_update_posts_count_on_transition_post_status

Handler for updating the blog posts count date when a post status changes.

Description

_update_posts_count_on_transition_post_status( (string) $new_status, (string) $old_status ); 

Parameters (2)

0. $new_status (string)
The status the post is changing to.
1. $old_status (string)
The status the post is changing from.

Usage

  1. if ( !function_exists( '_update_posts_count_on_transition_post_status' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-blogs.php'; 
  3.  
  4. // The status the post is changing to. 
  5. $new_status = ''; 
  6.  
  7. // The status the post is changing from. 
  8. $old_status = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = _update_posts_count_on_transition_post_status($new_status, $old_status); 
  12.  

Defined (1)

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

/wp-includes/ms-blogs.php  
  1. function _update_posts_count_on_transition_post_status( $new_status, $old_status ) { 
  2. if ( $new_status === $old_status ) { 
  3. return; 
  4.  
  5. if ( 'publish' !== $new_status && 'publish' !== $old_status ) { 
  6. return; 
  7.