Title: wp_schedule_update_user_counts
Published: May 25, 2022
Last modified: May 20, 2026

---

# wp_schedule_update_user_counts()

## In this article

 * [Source](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#wp--skip-link--target)

Schedules a recurring recalculation of the total count of users.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#source)󠁿

    ```php
    function wp_schedule_update_user_counts() {
    	if ( ! is_main_site() ) {
    		return;
    	}

    	if ( ! wp_next_scheduled( 'wp_update_user_counts' ) && ! wp_installing() ) {
    		wp_schedule_event( time(), 'twicedaily', 'wp_update_user_counts' );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/user.php#L1546)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/user.php#L1546-L1554)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_installing()](https://developer.wordpress.org/reference/functions/wp_installing/)`wp-includes/load.php` |

Checks or sets whether WordPress is in “installation” mode.

  | 
| [wp_next_scheduled()](https://developer.wordpress.org/reference/functions/wp_next_scheduled/)`wp-includes/cron.php` |

Retrieves the timestamp of the next scheduled event for the given hook.

  | 
| [wp_schedule_event()](https://developer.wordpress.org/reference/functions/wp_schedule_event/)`wp-includes/cron.php` |

Schedules a recurring event.

  | 
| [is_main_site()](https://developer.wordpress.org/reference/functions/is_main_site/)`wp-includes/functions.php` |

Determines whether a site is the main site of the current network.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_schedule_update_user_counts/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_schedule_update_user_counts%2F)
before being able to contribute a note or feedback.