Changeset 9866
- Timestamp:
- 05/13/2020 05:07:53 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php
r9369 r9866 27 27 add_filter( 'the_posts', array( __CLASS__, 'redirect_empty_search' ), 10, 2 ); 28 28 add_filter( 'the_posts', array( __CLASS__, 'rerun_search_without_results' ), 10, 2 ); 29 add_action( 'wp_head', array( __CLASS__, 'noindex_for_search' ), 9 ); 30 } 31 32 /** 33 * Outputs `noindex,follow` robots tag for search and post_type-filtered results. 34 */ 35 public static function noindex_for_search() { 36 if ( is_search() || isset( $_GET[ 'post_type' ] ) ) { 37 wp_no_robots(); 38 } 29 30 add_filter( 'wporg_noindex_request', array( __CLASS__, 'noindex_query' ) ); 31 } 32 33 /** 34 * Noindex post_type-filtered results. 35 */ 36 public static function noindex_query( $noindex ) { 37 if ( isset( $_GET[ 'post_type' ] ) ) { 38 $noindex = true; 39 } 40 41 return $noindex; 39 42 } 40 43
Note: See TracChangeset
for help on using the changeset viewer.