global $wpdb;
$min_posts = 5; // Make sure it's int, it's not escaped in the query
$author_ids = $wpdb->get_col("SELECT `post_author` FROM
(SELECT `post_author`, COUNT(*) AS `count` FROM {$wpdb->posts}
WHERE `post_status`='publish' GROUP BY `post_author`) AS `stats`
WHERE `count` >= {$min_posts} ORDER BY `count` DESC;");
// Do what you want to $author_ids from here on...
This will return the User IDs of the Authors with 5+ published posts and orders them descending, by post counts.
Related Posts:
- Find out if logged in user is not subscriber
- Get multiple roles with get_users
- User-edit role setting distinct from wp_capabilities? [closed]
- Delete all subscribers from wp_users and wp_usermeta a few thousand at a time
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- What the user_status column?
- Hide Admin Menu for Specific User ID who has administrator Role
- Problem with Hebrew characters in username
- Allowing an email as the username?
- Get the name of user who updated post
- Disable delete user
- Display edit link if post author is current user
- How to update user role without logout
- How to create a public profile for authors/contributors/users?
- How to insert new values to WordPress user Firstname and Surname Fields via DB
- How we can get the user id by its display_name
- WP_User_Query with combined meta query – not working?
- How to change WordPress user ID?
- How to assign an additional/extra/second user-role to multiple users (of a specific user-role)
- Can I hook into the invite user process to verify their email address is from a certain domain?
- wp_insert_user is not working for me?
- How to customize wp_signon()
- Is it possible to get a user with just the password field?
- Is there any way to access Ultimate Member’s custom fields?
- How to add country drop down menu to the user profile?
- New user notification doesn’t include activation link
- Use phpbb user database for WordPress
- User ability to favorite or ‘like’ content
- Users roles, make a page belonging to multiple users
- Add custom fields to the user profile
- Undeleting a deleted user
- A way to count logged in users and display count?
- stop login if user_status equal zero
- Disable user profile editing for one user
- Is it possible to get the currently logged in admin’s IP?
- Rule to redirect non logged in User to Custom Registration/login Page in .htaccess file
- How do i make my wordpress website private?
- Sort users by userID by default on users.php
- How to delete user on logout and when session expires?
- Remove Capabilities from WP admin for specific user role
- wordpress user roles are not working
- What is proper way to store info such as user marking a post as favorite? In post meta or user meta?
- What are some best practices for user exit strategy?
- Is there a way to identify a user in a custom REST API method? [duplicate]
- WP_User_Query – searching multiple fields
- wordpress disable login for unverified user
- Problem with automatic role change through cron job
- Profile page for user roles
- Search Function on a plugin WordPress User
- Calling User Nickname
- Print profile details as PDF or from modal window
- create new users in db starting at what ID?
- No more administrator roles / permissions after WordPress upgrade
- How to display text if profile fields are not filled?
- Load user by specific role
- Order users by user role
- Get user by meta key – WP multi site
- Force users to use password with specifications
- Change user slug in Buddypress
- Give users alternative/second avatar that is rectangle sized
- New User Save Filter
- Inserting current user ID into Post for Author
- Difference between is_user_logged_in and $_session[‘uname’]
- Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?
- Using get_user in wordpress with sorting
- Using my own user table
- How can I add authors in WordPress and assign them a picture?
- wp_generate_password sets password but can’t login using created password
- How to verify which WordPress user requested the API in ASP .NET Core?
- Get users meta and show to attribute
- How can admins to be notified of changes when users change their WP profiles?
- Custom Password Reset
- Can I add a unique code for each user based on the location?
- Can you Recover a WordPress User from a Backup
- wp-admin/users.php Add a column with last name
- Is nicename the same as nickname in WP?
- 502 Error when edit some users
- How to update a user with REST API v2 knowing only the username?
- How do I delete a wordpress user from giant database?
- get_users – Sort by a different meta_value than search criteria
- How to prevent deleteting specific user?
- Display recent members
- Update user counts in admin interface
- To save user info on the same page by form submiting
- Groups roles & capabilities
- Button for users to upgrade their user role + Button to show current user role!
- How do I Limit the number of pages a non-subscriber can see?
- Username has been exposed
- How To Find The ID Of All Registered Users?
- How to order posts by the user_login that corresponds to a meta_value (which is a user id)?
- Retrieve New user’s ID
- Restrict access to certain dashboard pages based on user id
- how to show logged in members username in wordpress content
- How to expire guest users after 1.5 hours logged in?
- User agent stylesheet distorting site [closed]
- WordPress – Security Question at Login from User’s Meta Data
- determine active user browser at the same time
- get Discussion setting in wordpress
- Set a minimal number for next user_id
- Remove My Account Menu items in Woocommerce based on user roles