Skip to content

Instantly share code, notes, and snippets.

@manchumahara
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save manchumahara/9910185 to your computer and use it in GitHub Desktop.
Save manchumahara/9910185 to your computer and use it in GitHub Desktop.
Search user in wordpress sidewide (at least at backend and if you use wp user query any where ) for user's display name , if you are here you know why I used this filter
add_filter('user_search_columns', 'user_search_columns_bd' , 10, 3);
function user_search_columns_bd($search_columns, $search, $this){
//if(!in_array($search_columns, 'display_name')){
if(!in_array('display_name', $search_columns)){
$search_columns[] = 'display_name';
}
return $search_columns;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment