WPSEO_Admin::switch_theme()publicYoast 1.0

Log the updated timestamp for user profiles when theme is changed.

{} Это метод класса: WPSEO_Admin{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$WPSEO_Admin = new WPSEO_Admin();
$WPSEO_Admin->switch_theme();

Код WPSEO_Admin::switch_theme() Yoast 19.7.1

public function switch_theme() {
	$wordpress_helper  = new Wordpress_Helper();
	$wordpress_version = $wordpress_helper->get_wordpress_version();

	// Capability queries were only introduced in WP 5.9.
	if ( version_compare( $wordpress_version, '5.8.99', '<' ) ) {
		$users = get_users( [ 'who' => 'authors' ] );
	}
	else {
		$users = get_users( [ 'capability' => [ 'edit_posts' ] ] );
	}

	if ( is_array( $users ) && $users !== [] ) {
		foreach ( $users as $user ) {
			update_user_meta( $user->ID, '_yoast_wpseo_profile_updated', time() );
		}
	}
}