wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_maybe_update_network_site_counts_on_update › WordPress Function

Since5.1.0
已弃用n/a
wp_maybe_update_network_site_counts_on_update ( $new_site, $old_site = null )
参数: (2)
  • (WP_Site) $new_site The site object that has been inserted, updated or deleted.
    Required: Yes
  • (WP_Site|null) $old_site Optional. If $new_site has been updated, this must be the previous state of that site. Default null.
    Required: No
    默认: null
定义在:
文档:

Updates the count of sites for a network based on a changed site.



源码

function wp_maybe_update_network_site_counts_on_update( $new_site, $old_site = null ) {
	if ( null === $old_site ) {
		wp_maybe_update_network_site_counts( $new_site->network_id );
		return;
	}

	if ( $new_site->network_id !== $old_site->network_id ) {
		wp_maybe_update_network_site_counts( $new_site->network_id );
		wp_maybe_update_network_site_counts( $old_site->network_id );
	}
}