Summery Summery
Get the user IDs of all users with no role on this site.
Syntax Syntax
Parameters Parameters
- $site_id
-
(Optional) The site ID to get users with no role for. Defaults to the current site.
Default value: null
Return Return
(string[]) Array of user IDs as strings.
Source Source
File: wp-includes/user.php
* * @since 4.0.0 */ function wp_destroy_all_sessions() { $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); $manager->destroy_all(); } /** * Get the user IDs of all users with no role on this site. * * @since 4.4.0 * @since 4.9.0 The `$site_id` parameter was added to support multisite. * * @param int|null $site_id Optional. The site ID to get users with no role for. Defaults to the current site. * @return string[] Array of user IDs as strings. */ function wp_get_users_with_no_role( $site_id = null ) { global $wpdb; if ( ! $site_id ) { $site_id = get_current_blog_id(); } $prefix = $wpdb->get_blog_prefix( $site_id ); if ( is_multisite() && get_current_blog_id() != $site_id ) { switch_to_blog( $site_id ); $role_names = wp_roles()->get_names(); restore_current_blog(); } else { $role_names = wp_roles()->get_names(); }
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.9.0 | The $site_id parameter was added to support multisite. |
4.4.0 | Introduced. |