Make WordPress Core

Opened 9 years ago

Last modified 6 years ago

#32234 new enhancement

Streamline parameter order of get_user_option()

Reported by: mechter's profile mechter Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.2.1
Component: Users Keywords:
Focuses: Cc:


get_user_meta() expects $user_id, followed by $meta_key. So do update_user_meta(), delete_user_meta(), update_user_option() and delete_user_option().

get_user_option() sticks out in that it expects these parameters in reversed order, which just caused me some major frustration even though I had looked it up before.

To enable backwards compability, we could test which of the two parameters is an integer and then swap them if necessary (unless of course meta keys can be integers too, I have not checked that, but it seems unlikely).

Change History (4)

#1 @SergeyBiryukov
9 years ago

  • Component changed from General to Users

#2 @JohnOlek
7 years ago

This just caused me some frustration too and I would love to see this updated for consistency.

#3 @johnjamesjacoby
6 years ago

Just ran into this.

I'm +1 to fixing this and handling the juggle inside of get_user_option().

#4 @johnbillion
6 years ago

This is annoying but fixing it reliably might be difficult. The meta key could be an integer (unlikely) and the user ID could be a numeric string.

Note: See TracTickets for help on using tickets.