I’d like to use get_users()
to return all users that have a particular meta_key, but I don’t want to specify what the value has to be because it will change for every user. The value is a json string. Is this possible?
Leave a Reply
You must be logged in to post a comment.
You can use the just the
meta_key
argument, the result will be similar to using theEXISTS
sql statement.Alternatively, you can use an empty string for
meta_value
(the default) and>
formeta_compare
. The result is the same (probably becausemeta_value
gets ignored if its empty!).The first method works when using
WP_Query
andmeta_query
as well. Example from a plugin of mine: