Get all users list and email address in WordPress

By October 10, 2017 WordPress 2 Comments
Get all users list and email address in WordPress

Get all user list ans email address in WordPress using WP_User_Query() and get_users()

In WordPress site you may need to get list of all user for many reason. there are many possible solutions are available by which you can access list of all resisted user to your site.

Here i am providing the best possible solutions to get list of all registered user.

Solution 1 : Get all user using WordPress WP_User_Query() function.

WP_User_Query() method was include in WordPress 3.1 version.  It allows querying the WordPress User database trough it’s available methods. It provide the easiest and secure way to access user from database.

Step 1. minimal code snippets  for getting all user email address in WordPress

Step 2. Explained and details code snippets for getting all user name and email in WordPress

Solution 2: Get all user name and email address using WordPress get_users() function.

You can get all users of WordPress using following code. These code print all WordPress user’s list.

This code snippets uses the get_users() method to get all user information and data.

Solution 3:  Get Users List by Role in WordPress

This are the WordPress per-defined user roles, you can fetch a specific types user also.

  • Super Admin
  • Administrator
  • Editor
  • Author
  • Subscriber
  • Contributor

Display all user of subscribers role:

This code snippets will fetch all subscribers user similarly you can get any user role specific list by changing “role” perimeter value in code .

Display all authors list of WordPress

 

 


About Vijay Dhanvai

A passionate blogger by heart and mind, I have been working in this field for 7 years now. A WordPress Professional, web developer and designer who intends to guide his readers about Web Design, WordPress, Blogging, Web Development, and more.

2 Comments

  • scottwest says:

    I’m new to WP and found your site. I love it.

    With the above code (Get all users list and email address in WordPress), what file do I insert it within? functions.php?

    Thanks for all the work you’ve done on this site,

    Scott

    • Hi Scott,
      Glade to see you here, You have to place this code in that file where you want to fetch or display User List with email ID, You can use this code for feting and mailing new updates on your site. The code snippets is only for “Get all users list and email address in WordPress”, Now it’s depends on your need how you process that data.

Leave a Reply