WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 10 months ago

Last modified 10 months ago

#21744 closed enhancement (wontfix)

WP_User_Query does not support post type

Reported by: AliMH Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Users Keywords: has-patch
Focuses: Cc:

Description

unfortunately WP_User_Query only support 'post' right now.
i've attached my modified user.php

Attachments (2)

user.php (45.2 KB) - added by AliMH 3 years ago.
21744.patch (761 bytes) - added by johnbillion 3 years ago.

Download all attachments as: .zip

Change History (11)

@AliMH
3 years ago

#1 follow-up: @wonderboymusic
3 years ago

WP_User_Query is meant to query and/or join wp_users and wp_usermeta, neither of which have anything to do with posts, unless you are talking about ordering by post_count? Even so, your 'post-type' query arg doesn't change the SQL.

What's your use case? Are you trying to order authors by their post count for a particular post_type?

Version 0, edited 3 years ago by wonderboymusic (next)

#2 @SergeyBiryukov
3 years ago

  • Keywords reporter-feedback added; has-patch removed

#3 @scribu
3 years ago

  • Cc scribu added

@johnbillion
3 years ago

#5 @johnbillion
3 years ago

AliMH's change in patch format

#6 in reply to: ↑ 1 @AliMH
3 years ago

  • Keywords has-patch added

Replying to wonderboymusic:

WP_User_Query is meant to query and/or join wp_users and wp_usermeta, neither of which have anything to do with posts, unless you are talking about ordering by post_count? What's your use case? Are you trying to order authors by their post count for a particular post_type?

sorry'i'm new in add patch to wordpress trac, thanks john for your help.
yea in post_count it's only support 'post' but most of time we need get post_count per post types.
this patch is not a big deal but need by alot of serious developer.

#7 @SergeyBiryukov
3 years ago

  • Keywords reporter-feedback removed

Related: #23045

#8 @chriscct7
10 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

This is something that can easily be done using custom query code, and isn't something core would benefit from by adding. Closing as wontifix

#9 @DrewAPicture
10 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.