_update_posts_count_on_delete( int $post_id, WP_Post $post )

In this article

Handler for updating the current site’s posts count when a post is deleted.

Parameters

$post_idintrequired
Post ID.
$postWP_Postrequired
Post object.

Source

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

	update_posts_count();
}

Changelog

VersionDescription
6.2.0Added the $post parameter.
4.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.