you can try to replace the where clause of the query by hooking to pre_user_query
. Something like:
function user_query_count_post_type($args){
$args->query_from = str_replace("post_type = post AND", "post_type IN ('post','cpt') AND ", $args->query_from);
}
Usage ex:
add_action('pre_user_query','user_query_count_post_type');
$users = get_users('orderby=post_count');
remove_action('pre_user_query','user_query_count_post_type');
Related Posts:
- Custom post type for ‘staff’ versus using wordpress user profiles?
- Showing User’s Post Counts by Custom Post Type in the Admin’s User List?
- Prevent trash/delete action on specific post types
- Front end registration/login & publish/update 1 custom post
- User roles – enable custom posts disable posts
- Allow User to Edit Page Based on their Email
- How to restrict specific post types from being read or added by specific user roles (eg. author)?
- How can I get the last posts by user role?
- Assigning a role to a specific custom post type (and ignoring other post types)
- WordPress allow access only one custom post type “xyz” to custom user role but need to hide all admin panels
- How to show custom post type count in the users admin page
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- Delete Current Author Frontend user while delete custom post type
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Link users to a custom post type
- Ajax Check Post Status
- Want to Add Custom Fields for Uploading video to WordPress Users from front end
- how to delete all users and posts based on ‘user_meta’?
- Roles for Custom Post Types
- Is using taxonomies the way to go here or would custom post types be better?
- Hiding posts by other users and non-logged in
- Users create/join groups
- Disable user from updating certain posts
- Query posts based on the meta key values of logged-in users?
- How to restrict author to only access one custom post type ?
- Create custom post with custom user rules
- Associate multiple users to custom post type
- How to assign permissions for a CPT to a user
- How can i display movies in profile page, added by an user?
- Custom User role not working with custom post type
- get comments by current user inside page template
- how to associate several authors to a custom post type
- Assign post type to many users
- Check if user has comment on current post
- Query within a foreach within a query (queryception)
- Showing User’s Post Counts by Custom Post Type in the Author.php?
- Add a custom post when inserting a new user in WordPress?
- Preventing role reading others posts
- Order users by number of posts (includes custom post type)
- Plugin needed to allow subscribers to post articles on the front end without admin approval [closed]
- Display custom post front end filter by ACF equals current user
- users post count
- Clone wp-admin/users.php (Users Admin Page)
- Link custom post type to users membership
- Show all post type posts in manage users posts column
- Limit 1 post by user in each custom post type
- Get all of a user’s posts (custom post type) then get cumulative value of a specific meta_key value from those posts
- Assign a Post to a User
- Add WordPress users to a custom post type
- Custom Post Type Query by user id
- Autofill advanced custom field with user data
- connect users to Custom post types
- Reference field of users in custom post type
- Custom Post Hierarchy and users
- UPDATED: Save a custom_field value when automatically creating a post using wp_insert_post
- Creating multiple profiles under one user to assign to particular posts
- Allow viewing the edit screen for a post type, but not make/save/publish/update changes
- Control what custom posts a user can see
- Associate custom categories to different user IDs
- Display and Allow users to edit their own profiles
- Check in function on custom page
- WordPress and Unity high scores table
- how to show Author post type count
- WordPress returns 404 on custom rewrite rule conflict in parameters
- custom post types, wp_get_archives and add_rewrite_rule
- wp_publish_post breaks permalinks
- How can we disable a custom post type archive page but enable its feed?
- How do you output custom code between posts in the loop?
- Editable content on a Custom Archive page
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- Disable featured image
- How I Can Delete Custom Post Type URL
- Filtering WP_Query
- Custom post type – get_day_link()
- Get related posts of child term of custom post type
- Content Editable CPT Archive?
- Custom database table question
- Removing full title and breadcrumb header container for a specific post type
- Using Pagination for Custom Post Type and keeps returning 404
- rewriterule not working
- CPT Repeatable Fields + Undefined Index
- Calling a div and content in php?
- Multiple custom post types on same admin page
- Custom field only on custom post type?
- Rewrite URL for CPT to domain/post-name/post-id
- Auto delete pages/posts without views
- How can I assign multiple parents to CPT?
- add_action for save_post_{type} resulting in WSOD
- Using meta boxes as the title of a custom post type
- CPT/Taxonomy/Postname permalink structure makes pagination break
- Custom Taxonomy not working front side Woocommerce
- How do i create user accounts from custom posts that have email addresses
- How to hide editor, but keep media library access
- Custom posts affecting Recent Posts
- Custom Taxonomy Showing in WP Menu
- Is it good practice to search for custom posts based on custom field values?
- Is it possible to create a separate page for custom posts gallery?
- Remove Permanent URL for custom post types
- Links in archive not including taxonomy parameter
- Get permalink in custom post type loop doesn’t work