Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the slow response, I’ve been away.

    You can query using the ‘meta_query’ argument. See Class_Reference/WP_User_Query#Custom_Field_Parameters. One typically knows which field they are searching for, but in your case this is not easily discerned unless you needlessly complicate the search form. You should be OK by placing the supplied search term in all possible fields, each linked together with the ‘OR’ relation.

    The relation argument is not that well documented, the example for multiple custom fields illustrates the correct usage. By using ‘OR’, any fields with no match to the search term should be essentially ignored.

Viewing 1 replies (of 1 total)

The topic ‘WP_User_Query Search Forms and Retrieving Custom Fields’ is closed to new replies.