Jetpack::maybe_clear_other_linked_admins_transient PHP Метод

maybe_clear_other_linked_admins_transient() публичный Метод

If a user has been promoted to or demoted from admin, we need to clear the jetpack_other_linked_admins transient.
С версии: 4.3.2
С версии: 4.4.0 $old_roles is null by default and if it's not passed, the transient is cleared.
public maybe_clear_other_linked_admins_transient ( integer $user_id, string $role, array $old_roles = null )
$user_id integer The user ID whose role changed.
$role string The new role.
$old_roles array An array of the user's previous roles.
    function maybe_clear_other_linked_admins_transient($user_id, $role, $old_roles = null)
    {
        if ('administrator' == $role || is_array($old_roles) && in_array('administrator', $old_roles) || is_null($old_roles)) {
            delete_transient('jetpack_other_linked_admins');
        }
    }
Jetpack