Making WordPress.org

Changeset 6855


Ignore:
Timestamp:
03/10/2018 02:26:02 PM (7 years ago)
Author:
Otto42
Message:

Plugins: Disable feeds for plugin listings and comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php

    r6801 r6855  
    4141        add_filter( 'pre_update_option_jetpack_options', array( $this, 'filter_jetpack_options' ) );
    4242        add_action( 'template_redirect', array( $this, 'prevent_canonical_for_plugins' ), 9 );
    43         add_action( 'template_redirect', array( $this, 'custom_redirects' ) );
     43        add_action( 'template_redirect', array( $this, 'custom_redirects' ), 1 );
    4444        add_filter( 'query_vars', array( $this, 'filter_query_vars' ) );
    4545        add_filter( 'single_term_title', array( $this, 'filter_single_term_title' ) );
     
    516516        remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
    517517
     518        // disable feeds
     519        remove_action( 'wp_head', 'feed_links', 2 );
     520        remove_action( 'wp_head', 'feed_links_extra', 3 );
     521
    518522        add_filter( 'get_term', array( __NAMESPACE__ . '\I18n', 'translate_term' ) );
    519523        add_filter( 'the_content', array( $this, 'translate_post_content' ), 1, 2 );
     
    11761180        if ( get_query_var( 's' ) && isset( $_GET['s'] ) ) {
    11771181            wp_safe_redirect( site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ) );
     1182            die();
     1183        }
     1184
     1185        // disable feeds
     1186        if ( is_feed() ) {
     1187            if( isset( $_GET['feed'] ) ) {
     1188                wp_redirect( esc_url_raw( remove_query_arg( 'feed' ) ), 301 );
     1189                die();
     1190            }
     1191            set_query_var( 'feed', '' );
     1192            redirect_canonical();
     1193            die();
     1194        }
     1195
     1196        if ( is_comment_feed() ) {
     1197            wp_redirect( 'https://wordpress.org/plugins/', 301 );
    11781198            die();
    11791199        }
Note: See TracChangeset for help on using the changeset viewer.