_update_posts_count_on_transition_post_status

Advertisement

Summery Summery

Handler for updating the current site’s posts count when a post status changes.

Syntax Syntax

_update_posts_count_on_transition_post_status( string $new_status, string $old_status, WP_Post $post = null )

Parameters Parameters

$new_status

(string) (Required) The status the post is changing to.

$old_status

(string) (Required) The status the post is changing from.

$post

(WP_Post) (Optional) Post object

Default value: null

Source Source

File: wp-includes/ms-blogs.php

	$post = get_post( $post_id );

	if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) {
		return;
	}

	update_posts_count();
}

/**
 * Handler for updating the current site's posts count when a post status changes.
 *
 * @since 4.0.0
 * @since 4.9.0 Added the `$post` parameter.
 *

Advertisement

Changelog Changelog

Changelog
Version Description
4.9.0 Added the $post parameter.
4.0.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.