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



switch_to_user_locale › WordPress Function

Since6.2.0
已弃用n/a
switch_to_user_locale ( $user_id )
参数:
  • (int) $user_id User ID.
    Required: Yes
返回:
  • (bool) True on success, false on failure.
定义在:
文档:

Switches the translations according to the given user's locale.



源码

function switch_to_user_locale( $user_id ) {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	if ( ! $wp_locale_switcher ) {
		return false;
	}

	return $wp_locale_switcher->switch_to_user_locale( $user_id );
}