There is an argument for this, and it is documented. If you look at the documentation for
get_users() is says this:
See WP_User_Query::prepare_query(). for more information on accepted arguments.
If you follow that link you’ll see the list of arguments, and one of those is:
(bool|array) Pass an array of post types to filter results to users who have published posts in those post types.
trueis an alias for all public post types.
So you can get published authors like this:
$authors = get_users( [ 'has_published_posts' => true ] );
Or, if you just want users who have published posts:
$authors = get_users( [ 'has_published_posts' => [ 'post' ], ] );
- How to allow an user role to create a new user under a role which lower than his level only?
- How to programatically change username (user_login)?
- How to get userid at wp_logout action hook?
- What’s the difference between the capability remove_users and delete_users?
- How to change user_login with wp-cli?
- Replacing the WordPress password validation
- How to let contributors to create a new revision(draft) editing their published posts
- How to hide media uploads by other users in the Media menu?
- Is there a way to set a user profile to Draft?
- Get users with atleast one post
- edit profile validation refreshes all field if missing wordpress
- How to order users alphabetically by their last name?
- Wp_User_Query not sorting by meta key
- Any reason to be concerned by a wave of “zombie” blog signups?
- Migrating users from .com to .org?
- How to list users that have written custom post types and hide the ones that have not?
- Front end user meta options for users
- Get total number of authors on the site
- How to migrate wordpress users from one blog to another
- Drop down list in user profile page
- Creating a Front-end based User Search
- How can I link users across multiple subdomains?
- Create user with author role but no login information
- Importing Existing Users with Passwords
- Create not-activated user in code, wordpress
- Is there any function available to echo current user’s profile url?
- Add user data to table when user is created?
- How to delete all post and attachments of a user when I delete it?
- Why wordpress showe “admin is editing…” whoever edits?
- Restricted registrations or removing the ability to edit your password/email
- Limit amout of sessions on user-by-user basis?
- Redirect user to login before viewing custom post
- Force user to change their password on first log in of site using shortcode
- Use wp_update_user to update custom column in wp_users table
- Create a front user register/login/profile & logout without interfering with wp-login.php?
- How to export bbPress (forums, topics, replies) and all users?
- Display users in order by an “order” custom meta field
- Rest API code to get ID of current user not working: get_current_user_id() gives 0
- Translate emails into the language of the user
- How to filter users by last_name?
- Can I check which users ran which updates?
- Extend backend User search to custom user meta
- Move users and passwords from one wordpress site to another
- Bulk lock users without email address?
- How to implement friend system for WordPress?
- Custom Query for count_user_posts function
- Delete user after Contact Form 7 submission [closed]
- cannot get user_registered date from get_user_meta
- Delete Users without a First and Last Name
- Display video on homepage for users who have not logged in
- Best way to get user id for get_users function?
- Author comment count in author page
- How to hide user profile fields based on the role of the viewed user?
- Customising “user ids” and add to ‘user’ panel in the admin area
- Add a sub menu page to the Users menu
- Get usermeta info from sql query
- redirect user to their profile after log in
- Confirm Deletion not found
- Get current user array into hyperlink
- how do I add role and capability after I create a new user
- Get Authors Role
- Need to exclude users with no posts from my contributors page
- link variable to user
- Changing user of post by changing ‘post_author’ field in ‘wp_posts’ table not taking effect. Where is the real post author info kept?
- How to auto-generate names for guest users who leave comments?
- Edit text of WordPress “Register” button
- How to safely trigger password reset emails for thousands of users
- Update user role for expired membership
- wp_insert_user error
- How to remember which page the user was on before logout?
- SQL to set Display Name to First Name + Last Name
- how to retrieve user via rest api using custom meta and/or email
- Create users by importing from CSV, with User ID assigned from CSV
- Moving users from joomla to wordpress
- How to customize user rest api?
- How to limit specific user ID to 5 comments per post?
- Deleted users still able to login
- Hook into add_user_role and update based on new and removed roles
- REST API list_user
- Auto approve new users if their username is included in a predefined list
- members only products
- Modify the user data stdObject and add extra items to it?
- Create relationships between users or user roles
- User Permissions on custom post type
- update custom field user profile from front end form
- Change “logged in as a ” link in comments form
- Specific Content on pages based on user
- throttle/limit a logged in user’s http requests to specific page on a per day basis
- I try to add informations to User profile
- force registered user as seller
- Not able to call value in the core files
- Fetching posts that match a User Profile setting
- Add a column before username in the users profile table
- Privacy in WordPress
- Create a wordpress admin user and only let them edit and post blog posts?
- how can i inform other users about new user registration? [closed]
- How to display Most Recently Read 10 Posts by a logged in user in wordpress
- How can I list users by date in an array in meta_value?
- Can I provide a user’s user_ID to them and can it also be searchable in a member’s directory
- application password is missing