wpseek.com
A WordPress-centric search engine for devs and theme authors



_update_posts_count_on_delete › WordPress Function

Since4.0.0
Deprecatedn/a
_update_posts_count_on_delete ( $post_id, $post )
Parameters: (2)
  • (int) $post_id Post ID.
    Required: Yes
  • (WP_Post) $post Post object.
    Required: Yes
Defined at:
Codex:
Change Log:
  • 6.2.0

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



Source

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

	update_posts_count();
}