Making WordPress.org

Changeset 8618


Ignore:
Timestamp:
04/10/2019 05:01:16 AM (8 years ago)
Author:
dd32
Message:

Support Forums: Deindex the Support Forum feeds.

Fixes #4336.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

    r8465 r8618  
    9595                add_filter( 'bbp_template_redirect', array( $this, 'disable_404_for_user_profile' ) );
    9696
     97                // Deindex Support Forum Feeds. bbPress hooks in way earlier than most Core feed functions..
     98                add_action( 'request', array( $this, 'deindex_forum_feeds' ), 5 );
    9799        }
    98100
    … …  
    859861                }
    860862        }
     863
     864        /**
     865         * Deindex Forum feeds.
     866         *
     867         * bbPress hooks in way earlier than most Core feed functions, so this is hooked to 'request' at priority 5.
     868         */
     869        function deindex_forum_feeds( $query_vars ) {
     870                if ( isset( $query_vars['feed'] ) ) {
     871                        header( 'X-Robots-Tag: noindex, follow' );
     872                }
     873
     874                return $query_vars;
     875        }
    861876}
Note: See TracChangeset for help on using the changeset viewer.