Making WordPress.org


Ignore:
Timestamp:
07/19/2019 02:02:48 AM (5 years ago)
Author:
dd32
Message:

Theme Directory: We don't support paginated requests to the theme directory, redirect them to their non-paginated variants to avoid 404 pages.

See #4613.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r8935 r9064  
    4747        $url = str_ireplace( '/index.php', '/', $_SERVER['REQUEST_URI'] );
    4848        wp_safe_redirect( $url, 301 );
     49        die();
     50    }
     51
     52    // We don't support pagination on the directory at present.
     53    if ( get_query_var( 'paged' ) ) {
     54        $url = remove_query_arg( 'paged' );
     55        $url = preg_replace( '!page/\d+!i', '', $url );
     56
     57        // Remove any double slashes
     58        $url = preg_replace( '!/{2,}!', '/', $url );
     59
     60        wp_safe_redirect( $url ); // Not 301, as paginated requests will one day be supported hopefully.
    4961        die();
    5062    }
Note: See TracChangeset for help on using the changeset viewer.