Changeset 3278
- Timestamp:
- 05/31/2016 07:44:10 PM (10 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
- Files:
-
- 2 edited
-
inc/search.php (modified) (2 diffs)
-
searchform.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php
r3276 r3278 25 25 add_filter( 'posts_orderby', array( __CLASS__, 'search_posts_orderby' ), 10, 2 ); 26 26 add_filter( 'the_posts', array( __CLASS__, 'rerun_empty_exact_search' ), 10, 2 ); 27 add_filter( 'query_vars', array( __CLASS__, 'default_qv_empty_post_type_search' ) ); 28 } 29 30 /** 31 * Add query var to indicate if no post type filters were explicitly used for 32 * a search. 33 * 34 * Defaults the query var 'empty_post_type_search' to false. It is potentially 35 * set to true elsewhere. 36 * 37 * @param array $public_query_vars The array of whitelisted query variables. 38 * @return array 39 */ 40 public static function default_qv_empty_post_type_search( $public_query_vars ) { 41 $public_query_vars['empty_post_type_search'] = false; 42 return $public_query_vars; 27 43 } 28 44 … … 66 82 67 83 if ( ! $qv_post_types ) { 84 // Record the fact no post types were explicitly supplied. 85 $query->set( 'empty_post_type_search', true ); 86 68 87 // Not a handbook page, or exact search, or filters used. 69 88 // Fallback to parsed post types. -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/searchform.php
r3243 r3278 62 62 63 63 $qv_post_type = array_filter( (array) get_query_var( 'post_type' ) ); 64 $no_filters = get_query_var( 'empty_post_type_search' ); 64 65 65 if ( ! is_search() || in_array( 'any', $qv_post_type ) ) {66 // no filters used66 if ( ! is_search() || in_array( 'any', $qv_post_type ) || $no_filters ) { 67 // No filters used. 67 68 $qv_post_type = array(); 68 69 }
Note: See TracChangeset
for help on using the changeset viewer.