Use a single control to filter by several fields in the members directory.

This example shows how to group several filters in the Members Directory. For example there are three phone fields in the profile ("Phone", "Phone number", "Mobile Number"), but you want to use a single filter "Phone number" to filter by these three fields in the Member Directory.

This solution is not recommended because it significantly slows down the directory. The relationship between the number of combined fields and slowdown is power-law: combining two fields slows down the search by two times, combining three fields - four times, four fields - eight times, and so on. It may be better to use a general search line instead.

This code works if the setting "Enable custom table for usermeta" is turned on. See the gist otherwise.

NOTE: We have created this code example to provide guidance and to make it easier for you to implement this code into your website. However, we are not able to provide any support when it comes to customizing the plugin. If you need help implementing this code, please hire a developer.