返回介绍

clean_user_cache()

发布于 2017-09-10 21:44:44 字数 2140 浏览 1126 评论 0 收藏 0

clean_user_cache( WP_User|int $user )

Clean all user caches


description


参数

$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 );
}

更新日志

Versiondescription
4.4.0'clean_user_cache' action was added.
3.0.0Introduced.

相关函数

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文