@@ -774,7 +774,7 @@ public function fill_query_vars( $query_vars ) {
774774 * character used for exclusion can be modified using the
775775 * the 'wp_query_search_exclusion_prefix' filter.
776776 * @type string[] $search_columns Array of column names to be searched. Accepts 'post_title',
777- * 'post_excerpt' and 'post_content '. Default empty array.
777+ * 'post_excerpt', 'post_content' and 'post_name '. Default empty array.
778778 * @type int $second Second of the minute. Default empty. Accepts numbers 0-59.
779779 * @type bool $sentence Whether to search by phrase. Default false.
780780 * @type bool $suppress_filters Whether to suppress filters. Default false.
@@ -1452,8 +1452,10 @@ protected function parse_search( &$query_vars ) {
14521452 $ searchand = '' ;
14531453 $ query_vars ['search_orderby_title ' ] = array ();
14541454
1455- $ default_search_columns = array ( 'post_title ' , 'post_excerpt ' , 'post_content ' );
1456- $ search_columns = ! empty ( $ query_vars ['search_columns ' ] ) ? $ query_vars ['search_columns ' ] : $ default_search_columns ;
1455+ $ default_search_columns = array ( 'post_title ' , 'post_excerpt ' , 'post_content ' );
1456+ $ allowed_search_columns = $ default_search_columns ;
1457+ $ allowed_search_columns [] = 'post_name ' ;
1458+ $ search_columns = ! empty ( $ query_vars ['search_columns ' ] ) ? $ query_vars ['search_columns ' ] : $ default_search_columns ;
14571459 if ( ! is_array ( $ search_columns ) ) {
14581460 $ search_columns = array ( $ search_columns );
14591461 }
@@ -1473,7 +1475,7 @@ protected function parse_search( &$query_vars ) {
14731475 $ search_columns = (array ) apply_filters ( 'post_search_columns ' , $ search_columns , $ query_vars ['s ' ], $ this );
14741476
14751477 // Use only supported search columns.
1476- $ search_columns = array_intersect ( $ search_columns , $ default_search_columns );
1478+ $ search_columns = array_intersect ( $ search_columns , $ allowed_search_columns );
14771479 if ( empty ( $ search_columns ) ) {
14781480 $ search_columns = $ default_search_columns ;
14791481 }
0 commit comments