Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#18581 closed defect (bug) (wontfix)

get_user codex said thet meta_keys could be used in 'fields' - sql error

Reported by: anmari Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.2.1
Component: Users Keywords:
Focuses: Cc:


The codex entryhttp://codex.wordpress.org/Function_Reference/get_users#Parameters said that the fields argument would accept meta_keys.

However in 3.2.1 and 3.3 using meta_keys gives a sql error.
Using normal user table fields is fine.

I have corrected the codex for now, but in case this was really intended functionality, thought I better log it too.

Attachments (1)

db_error.png (6.0 KB) - added by anmari 10 years ago.
sql error

Download all attachments as: .zip

Change History (4)

10 years ago

sql error

#1 follow-up: @dd32
10 years ago

Looking at the function, it doesn't appear that it's ever supported meta keys in the fields param, The field selected is always prefixed with the users table. It looks like the documentation is simply wrong to me.. The functions it replaced might have however accepted meta keys..

#2 in reply to: ↑ 1 @SergeyBiryukov
10 years ago

Replying to dd32:

The functions it replaced might have however accepted meta keys..

get_users() replaced get_users_of_blog(), however that function didn't accept meta keys either.

So should WP_User_Query be updated to allow meta keys in the fields parameter, or, now that the documentation is corrected, this ticket can be closed?

#3 @scribu
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Since WP_User_Query returns magical WP_User objects with which you can access any custom field, I don't think this is needed.

Note: See TracTickets for help on using tickets.