WordPress.org

Making WordPress.org

Changeset 9185


Ignore:
Timestamp:
10/15/2019 10:00:52 PM (18 months ago)
Author:
coffee2code
Message:

Developer: Output a 'noindex,follow' meta tag for listings filtered by post_type.

Props jonoaldersonwp, coffee2code.
Fixes #4648.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/search.php

    r9000 r9185  
    2525        add_filter( 'posts_orderby', array( __CLASS__, 'search_posts_orderby' ), 10, 2 );
    2626        add_filter( 'the_posts',     array( __CLASS__, 'rerun_empty_search' ), 10, 2 );
    27         add_action( 'wp_head',       array( __CLASS__, 'noindex_for_search' ) );
    28     }
    29 
    30     /**
    31      * Outputs `noindex,follow` robots tag for search results.
     27        add_action( 'wp_head',       array( __CLASS__, 'noindex_for_search' ), 9 );
     28    }
     29
     30    /**
     31     * Outputs `noindex,follow` robots tag for search and post_type-filtered results.
    3232     */
    3333    public static function noindex_for_search() {
    34         if ( is_search() ) {
     34        if ( is_search() || isset( $_GET[ 'post_type' ] ) ) {
    3535            wp_no_robots();
    3636        }
Note: See TracChangeset for help on using the changeset viewer.