^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 5年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云1核2g仅需102元/年,今日10点开抢

wordpress函数clean_user_cache()用法示例

clean_user_cache( WP_User|int $user )

Clean all user caches


描述


参数

$user

(WP_User|int)
(Required)
User object or ID to be cleaned from the cache


源代码

File: wp-includes/user.php

function clean_user_cache( $user ) {
	if ( is_numeric( $user ) )
		$user = new WP_User( $user );

	if ( ! $user->exists() )
		return;

	wp_cache_delete( $user->ID, 'users' );
	wp_cache_delete( $user->user_login, 'userlogins' );
	wp_cache_delete( $user->user_email, 'useremail' );
	wp_cache_delete( $user->user_nicename, 'userslugs' );

	/**
	 * Fires immediately after the given user's cache is cleaned.
	 *
	 * @since 4.4.0
	 *
	 * @param int     $user_id User ID.
	 * @param WP_User $user    User object.
	 */
	do_action( 'clean_user_cache', $user->ID, $user );
}

更新日志

Version 描述
4.4.0 ‘clean_user_cache’ action was added.
3.0.0 Introduced.

相关函数

Uses

  • wp-includes/user.php:
    clean_user_cache
  • wp-includes/class-wp-user.php:
    WP_User::__construct()
  • wp-includes/cache.php:
    wp_cache_delete()
  • wp-includes/plugin.php:
    do_action()

Used By

  • wp-admin/includes/ms.php:
    wpmu_delete_user()
  • wp-admin/includes/ms.php:
    update_user_status()
  • wp-admin/includes/ms.php:
    refresh_user_details()
  • wp-admin/includes/user.php:
    wp_delete_user()
  • wp-includes/deprecated.php:
    delete_usermeta()
  • wp-includes/deprecated.php:
    update_usermeta()
  • Show 1 more used by
    Hide more used by


User Contributed Notes

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈