Making WordPress.org

Changeset 8603


Ignore:
Timestamp:
04/05/2019 04:05:56 PM (6 years ago)
Author:
coffee2code
Message:

Plugin Directory: Redirect tag archive of existing tag without any plugins to a search for that tag, as done for nonexistent tags.

Props jonoaldersonwp, coffee2code.
Fixes #4366.

File:
1 edited

Legend:

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

    r8587 r8603  
    12181218        if ( get_query_var( 's' ) && isset( $_GET['s'] ) ) {
    12191219            wp_safe_redirect( site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ), 301 );
     1220            die();
     1221        }
     1222
     1223        // Existing tag with no plugins.
     1224        if ( is_tax() && ! $GLOBALS['wp_query']->have_posts() ) {
     1225            // [1] => plugins [2] => tags [3] => example-plugin-name [4..] => random().
     1226            $path = explode( '/', $_SERVER['REQUEST_URI'] );
     1227
     1228            wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ), 301 );
    12201229            die();
    12211230        }
Note: See TracChangeset for help on using the changeset viewer.