WordPress.org

Making WordPress.org

Changeset 7789


Ignore:
Timestamp:
10/27/2018 08:52:43 AM (14 months ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Redirect empty search queries to home page.

Props jonoaldersonwp.
Fixes #3852. Fixes #3853.

File:
1 edited

Legend:

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

    r7788 r7789  
    11841184        }
    11851185
    1186         // new-style Search links.
     1186        // New-style search links.
    11871187        if ( get_query_var( 's' ) && isset( $_GET['s'] ) ) {
    11881188            wp_safe_redirect( site_url( '/search/' . urlencode( get_query_var( 's' ) ) . '/' ), 301 );
     1189            die();
     1190        }
     1191
     1192        // Empty search query.
     1193        if ( 'search' === get_query_var( 'name' ) || isset( $_GET['s'] ) && ! get_query_var( 's' ) ) {
     1194            wp_safe_redirect( site_url( '/' ), 301 );
    11891195            die();
    11901196        }
Note: See TracChangeset for help on using the changeset viewer.