Changeset 50790 for trunk/src/wp-includes/user.php
- Timestamp:
- 04/26/2021 01:02:34 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/user.php
r50641 r50790 1562 1562 * @since 3.0.0 1563 1563 * @since 4.4.0 'clean_user_cache' action was added. 1564 * @since 5.8.0 Refreshes the global user instance if cleaning the user cache for the current user. 1565 * 1566 * @global WP_User $current_user The current user object which holds the user data. 1564 1567 * 1565 1568 * @param WP_User|int $user User object or ID to be cleaned from the cache 1566 1569 */ 1567 1570 function clean_user_cache( $user ) { 1571 global $current_user; 1572 1568 1573 if ( is_numeric( $user ) ) { 1569 1574 $user = new WP_User( $user ); … … 1588 1593 */ 1589 1594 do_action( 'clean_user_cache', $user->ID, $user ); 1595 1596 // Refresh the global user instance if the cleaning current user. 1597 if ( get_current_user_id() === (int) $user->ID ) { 1598 $user_id = (int) $user->ID; 1599 $current_user = null; 1600 wp_set_current_user( $user_id, '' ); 1601 } 1590 1602 } 1591 1603
Note: See TracChangeset
for help on using the changeset viewer.