Making WordPress.org

Changeset 5461


Ignore:
Timestamp:
05/02/2017 04:37:48 PM (7 years ago)
Author:
Otto42
Message:

Plugin Directory: Redirect 404s to plugin search using the slug as the search term. Fixes #2755. Props @gibrown

File:
1 edited

Legend:

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

    r5457 r5461  
    10171017
    10181018            if ( 'tags' === $path[2] ) {
    1019                 if ( isset( $path[3] ) ) {
     1019                if ( isset( $path[3] ) && !empty( $path[3] ) ) {
    10201020                    wp_safe_redirect( home_url( '/search/' . urlencode( $path[3] ) . '/' ) );
    10211021                    die();
     
    10441044            }
    10451045
    1046             // Otherwise, handle a plugin redirect.
     1046            // Handle any plugin redirects.
    10471047            if ( $path[2] && ( $plugin = self::get_plugin_post( $path[2] ) ) ) {
    10481048                $permalink = get_permalink( $plugin->ID );
     
    10511051                    die();
    10521052                }
     1053            }
     1054
     1055            //Otherwise, let's redirect to the search page
     1056            if ( isset( $path[2] ) && !empty( $path[2] ) ) {
     1057                wp_safe_redirect( home_url( '/search/' . urlencode( $path[2] ) . '/' ) );
     1058                die();
    10531059            }
    10541060        }
Note: See TracChangeset for help on using the changeset viewer.