Last active
June 19, 2020 06:53
-
-
Save mehrshaddarzi/86c5f72fec63a5ee0a7ad5bf0dbb2f12 to your computer and use it in GitHub Desktop.
Add support for the "display_name" search column in WP_User_Query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'user_search_columns', 'filter_function_name', 10, 3 ); | |
function filter_function_name( $search_columns, $search, $wp_user_query ) { | |
$search_columns[] = 'user_url'; | |
return $search_columns; | |
} | |
//Where 'filter_function_name' is the function WordPress should call when filter is run. Note that the filter function must return an value after it is finished processing or the search terms will be empty. | |
//filter_function_name should be unique function name. It cannot match any other function name already declared. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment