Get WordPress user_id from meta_key meta_value pair

Earlier today I was working on a user-account class that talks to an api and needed to get the associated user_id from the returned value. All I had to from was a custom user_meta value and the meta_key. I figured there would be a wp function called get_user_id_by_meta, or something similar, but I didn’t find one. So, I made one.

This function is rather simple, but could easily be much more. This function is actually a method in a class so the naming convention is safe. However, if you plan to use it outside of a class I suggest that you change the name.

Get a WordPress users id from meta_key and meta_value:

If you found this helpful please let me know. If you have any questions, comments, or a more efficient way let me know.

Box Eye

Box Eye

I was browsing through my drawings this afternoon and saw this one. Sometimes it’s more apparent that my drawing start off as nothing and evolve as they go on, and I this is definitely one of them.

I started by drawing a box and then it just started morphing into more. I really like drawing little odd characters that seem like they are stuck in a fishbowl. [...] Read More

October in Photos 2011

October in Photos 2011

This month ended with me getting a new phone so I was really excited about better picture quality and a faster camera. My old phone was so slow that the camera wouldn’t even open. So you can expect a lot more useless pictures in the next couple of months.

[...] Read More

July in Photos 2011

July in Photos 2011

Here are my totally random pics from July 2011! :p Not much this month, I guess you could say I’ve been busy!

[...] Read More