Adding custom user meta to search field on Users page in WordPress
-
I have added a custom meta value to each user and I have also added it to a custom sortable column on the users.php screen but I am now trying to incorporate this custom meta value into the “Search Users” search box.
I have tried this code but it completely broke the search box, even searching the standard fields showed no results.
Any help would be appreciated.
'company_name' is the name of my custom value add_filter( 'user_search_columns', 'search_company_column', 10, 3 ); function search_company_column( $search_columns, $search, $wp_user_query ) { $search_columns[] = 'company_name'; return $search_columns; }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Adding custom user meta to search field on Users page in WordPress’ is closed to new replies.