wp_schedule_update_user_counts

函式
wp_schedule_update_user_counts ( No parameters )

wp_schedule_update_user_counts: 這是一個WordPress的函式,用來安排更新WordPress網站上的使用者數。它允許你指定一個時間間隔和一個回撥函式,該函式將在該時間間隔執行,以更新使用者數。例如,你可以用這個函式來安排一天一次的更新。

計劃定期重新計算使用者的總人數。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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' );
}
}
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' ); } }
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' );
	}
}

常見問題

FAQs
檢視更多 >