Use get_users function it allows you to query user by role.
For contributors,
$contributors = get_users('role=contributors');
foreach($contributors as $contributors){
// do something with contributors
}
For Admins,
$admins = get_users('role=admin');
foreach($admins as $admins){
// do something with admins
}
replace role=* with your desired roles.
Related Posts:
- Author list based on recently active
- Authors & profiles (and exclude ID’s)
- Display a list of all post from the Author in the author’s page (author.php) in alphebetical order
- How to add avatar to authors list?
- Select subscriber as author of post in admin panel?
- Echo author ID in author.php
- How can HTML be allowed in Author Bio?
- Restrict one post per author
- How to get post author name by its ID inside a function?
- If Else Gravatar Author Picture
- Add rewrite endpoint to author page + pagination
- How can an author be subscribed to the posts of another author and receive notifications of the new posts?
- Show author archive pages for authors with no posts
- How we can get the author ID by its Name
- How to hide posts count and posts of other users from edit.php for contributors and authors
- Custom size for image uploaded to custom field in user profile?
- Creating distinct pages for author profiles and lists of posts by author
- Making WordPress author follow button, need missing ingredient
- Get the comment author ID by the comment ID
- How To Remove The Author(s) From Certain Posts
- Remove /author/ from the author profile url
- Google Authorship on a multi-author blog?
- Replace Gravatar with img URL for avatars
- Change author base slug to user role
- Custom Author Fields + Existing Taxonomy – Integrating the Two Dynamically?
- WordPress Author Page
- What is wrong with this code?
- Limit REST API output to current logged in user that is also author of the content
- Display only entire most recent post on author page?
- I only want to Display Author Link in authors bio
- Is it possible to get_terms by author?
- Custom Author Loop
- Showing author’s page with no posts
- Plugin for an author bio popup box?
- How to link to the current User/Author Profile page?
- Change destination of author link to BuddyPress member profile
- Conditional/Check: IF comment author is the post author
- Get last revision author, author-link and date
- What do you put in child themes author tag?
- Make user as Default contributor for all Blog Posts
- How to list the authors of all revisions?
- WordPress doesn’t show all posts of a specific author
- Custom avatar image link added to the profile page
- Post list based on the page author
- Show Author information on post page on dashboard
- Author posts url… way to get display name to be url instead of user’s ID?
- Display emails of users who already posted at least once
- Get author’s first name
- Display only author posts in dashboard all posts panel
- Get avatar of the logged-in user in WordPress
- What does the class look like that is returned from WP_User_Query?
- Breadcrumbs – get the author?
- Is author.php a core file?
- Allow Google crawler to crawl specific Author pages
- Clean links in: the_author_meta(‘description’)
- Add Date and Author to Posts
- Changes show up in view source but not live site
- Declare global var from Template File and use it in Functions.php
- Getting list of top 10 users and sort on last name
- author slug in the backend
- Can I Include author login in post class?
- Get 404 when try open author page
- get the headlines of the authors’ last post
- WordPress User role → Fetch and Print(echo)
- Get Author Count By Day, Week and Month
- Detect and make links nofollow in author description
- Working with Gravatars within a localhost development area
- Author Page Create Link to Page That Lists All Author’s Posts?
- Authors divided alphabetically
- Author Page List – change to show authors instead of not subscribers
- Display all authors in a theme template
- post author if statement
- Add Post Author body class to WordPress
- How to show list authors with at least five posts published
- Display posts differently depending on which author wrote it
- How to have certain WordPress settings set by default on a per author basis
- Best way to set up “reviewed by” in WordPress?
- Filter Author Link for Numerous Authors for each to go to unique page
- can’t see information on author page that don’t have posts
- How to create many author’s page?
- get_author_posts_url() Not working
- Creating a button from data from Author meta
- How to get the Author type Label Language
- Sticky post of current viewing author?
- How to get latest page (not post) of User and display the content
- How to change the post author when the post is published?
- How do you display a comment into a mail?
- Create a Page Template Which Displays All Posts by Current User
- Remove post author using child theme
- if else for custom $curauth-> field
- Author.php display profile for all types of users
- Author Link Not Displaying
- Return one of user’s post from a category in user’s profile
- Exclude Author by ID
- Removing “HTTP://” From the_author_meta?
- Multiple Authors per post and filter post by author
- Permission to change post Author
- Replace author with custom field in feed
- why is there an author.php
- How to force the Author Dropdown to display in Quick/Bulk edit?