Making WordPress.org

Changeset 9187


Ignore:
Timestamp:
10/16/2019 04:08:07 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: 301 all the canonical redirects.

See #4630.

File:
1 edited

Legend:

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

    r9160 r9187  
    471471
    472472        register_meta( 'post', 'assets_icons', array(
    473             'type'         => 'array',
     473            'type'         => 'UserDefinedarray',
    474474            'description'  => __( 'Icon images of the plugin.', 'wporg-plugins' ),
    475475            'single'       => true,
     
    11991199        // Handle a redirect for /$plugin/$tab_name/ to /$plugin/#$tab_name.
    12001200        if ( get_query_var( 'redirect_plugin' ) && get_query_var( 'redirect_plugin_tab' ) ) {
    1201             wp_safe_redirect( site_url( get_query_var( 'redirect_plugin' ) . '/#' . get_query_var( 'redirect_plugin_tab' ) ) );
     1201            wp_safe_redirect( site_url( get_query_var( 'redirect_plugin' ) . '/#' . get_query_var( 'redirect_plugin_tab' ) ), 301 );
    12021202            die();
    12031203        }
     
    12061206        if ( is_404() ) {
    12071207
    1208             // [1] => plugins [2] => example-plugin-name [2..] => random().
     1208            // [1] => plugins [2] => example-plugin-name [3..] => random().
    12091209            $path = explode( '/', $_SERVER['REQUEST_URI'] );
    12101210
    12111211            if ( 'tags' === $path[2] ) {
    12121212                if ( isset( $path[3] ) && ! empty( $path[3] ) ) {
    1213                     wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ) );
     1213                    wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ), 301 );
    12141214                    die();
    12151215                } else {
    1216                     wp_safe_redirect( home_url( '/' ) );
     1216                    wp_safe_redirect( home_url( '/' ), 301 );
    12171217                    die();
    12181218                }
     
    12221222            if ( 'about' === $path[2] ) {
    12231223                if ( isset( $path[3] ) && 'add' == $path[3] ) {
    1224                     wp_safe_redirect( home_url( '/developers/add/' ) );
     1224                    wp_safe_redirect( home_url( '/developers/add/' ), 301 );
    12251225                } elseif ( isset( $path[3] ) && 'validator' == $path[3] ) {
    1226                     wp_safe_redirect( home_url( '/developers/readme-validator/' ) );
     1226                    wp_safe_redirect( home_url( '/developers/readme-validator/' ), 301 );
    12271227                } else {
    1228                     wp_safe_redirect( home_url( '/developers/' ) );
     1228                    wp_safe_redirect( home_url( '/developers/' ), 301 );
    12291229                }
    12301230                die();
     
    12331233            // Browse 404s.
    12341234            if ( 'browse' === $path[2] ) {
    1235                 wp_safe_redirect( home_url( '/' ) );
     1235                wp_safe_redirect( home_url( '/' ), 301 );
    12361236                die();
    12371237            }
     
    12491249                $permalink = get_permalink( $plugin->ID );
    12501250                if ( parse_url( $permalink, PHP_URL_PATH ) != $_SERVER['REQUEST_URI'] ) {
    1251                     wp_safe_redirect( $permalink );
     1251                    wp_safe_redirect( $permalink, 301 );
    12521252                    die();
    12531253                }
     
    12561256            // Otherwise, let's redirect to the search page.
    12571257            if ( isset( $path[2] ) && ! empty( $path[2] ) ) {
    1258                 wp_safe_redirect( home_url( '/search/' . urlencode( $path[2] ) . '/' ) );
     1258                wp_safe_redirect( home_url( '/search/' . urlencode( $path[2] ) . '/' ), 301 );
    12591259                die();
    12601260            }
     
    12971297        // disable feeds
    12981298        if ( is_feed() ) {
    1299             if( isset( $_GET['feed'] ) ) {
     1299            if ( isset( $_GET['feed'] ) ) {
    13001300                wp_redirect( esc_url_raw( remove_query_arg( 'feed' ) ), 301 );
    13011301                die();
Note: See TracChangeset for help on using the changeset viewer.