wordpress / latest / functions / _update_posts_count_on_delete.html

_update_posts_count_on_delete( int $post_id )

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

Parameters

$post_id int Required
Post ID.

Source

File: wp-includes/ms-blogs.php. View all references

function _update_posts_count_on_delete( $post_id ) {
	$post = get_post( $post_id );

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

	update_posts_count();
}

Uses

Uses Description

Changelog

Version Description
4.0.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_update_posts_count_on_delete