Making WordPress.org


Ignore:
Timestamp:
04/09/2019 07:52:26 PM (8 years ago)
Author:
Otto42
Message:

Plugins: Prevent invalid values from being passed to browse, and cause them to redirect somewhere else. This should prevent crawlers from having some rather silly results.

File:
1 edited

Legend:

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

    r8603 r8615  
    727727                if ( empty( $wp_query->query ) ) {
    728728                        $wp_query->query_vars['browse'] = 'featured';
     729                }
     730
     731                // For any invalid values passed to browse, set it to featured instead
     732                if ( !empty ( $wp_query->query ['browse'] ) &&
     733                     !in_array( $wp_query->query['browse'], array( 'featured','popular','beta','blocks','new','favorites' ) ) ) {
     734                         $wp_query->query['browse'] = 'featured';
     735                         $wp_query->query_vars['browse'] = 'featured';
    729736                }
    730737
Note: See TracChangeset for help on using the changeset viewer.