Title: get_users_of_blog
Published: April 25, 2014
Last modified: August 20, 2026

---

# get_users_of_blog( int $id = ” ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#changelog)

This function has been deprecated since 3.1.0. Use [get_users()](https://developer.wordpress.org/reference/functions/get_users/)
instead.

Get users for the site.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#description)󠁿

For setups that use the multisite feature. Can be used outside of the multisite 
feature.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#see-also)󠁿

 * [get_users()](https://developer.wordpress.org/reference/functions/get_users/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#parameters)󠁿

 `$id`intoptional

Site ID.

Default:`''`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#return)󠁿

 array List of users that are part of that site ID

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#source)󠁿

    ```php
    function get_users_of_blog( $id = '' ) {
    	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );

    	global $wpdb;
    	if ( empty( $id ) ) {
    		$id = get_current_blog_id();
    	}
    	$blog_prefix = $wpdb->get_blog_prefix($id);
    	$users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
    	return $users;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/deprecated.php#L2389)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/deprecated.php#L2389-L2399)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#related)󠁿

| Uses | Description | 
| [wpdb::get_blog_prefix()](https://developer.wordpress.org/reference/classes/wpdb/get_blog_prefix/)`wp-includes/class-wpdb.php` |

Gets blog prefix.

  | 
| [get_current_blog_id()](https://developer.wordpress.org/reference/functions/get_current_blog_id/)`wp-includes/load.php` |

Retrieves the current site ID.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  | 
| [wpdb::get_results()](https://developer.wordpress.org/reference/classes/wpdb/get_results/)`wp-includes/class-wpdb.php` |

Retrieves an entire SQL result set from the database (i.e., many rows).

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_users_of_blog/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Deprecated. Use [get_users()](https://developer.wordpress.org/reference/functions/get_users/)  | 
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_users_of_blog%2F)
before being able to contribute a note or feedback.