Limit the Search in Member Directory with UM Custom Meta Data table
When using the um_metatable and using the search bar in the member directory, it searches the following core fields:
- ‘user_login’,
- ‘user_url’,
- ‘display_name’,
- ‘user_email’,
- ‘user_nicename’,
To limit the search, let’s say only search for the first name with meta table for meta key “
first_name”, you can try and add the code snippet below to your theme’s functions.php file or use the Code Snippets plugin:
By default, UM stores the user meta in the wp_usermeta table but when the custom UM meta table is enabled, it stores the user meta in the wp_um_metadata table. You can enable the meta table in
WP-Admin > UM > Settings > Misc > “Enable custom table for usermeta”