Making WordPress.org

Changeset 8224


Ignore:
Timestamp:
02/12/2019 01:29:28 AM (6 years ago)
Author:
dd32
Message:

WordPress.org: Force a 404 for any logged out paged requests above MAX_PAGES, this is done to avoid bbPress overriding it later.

See #4167.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-page-limiter.php

    r8174 r8224  
    3838    }
    3939
    40     // Pre-query, ensure we flag this request as a 404 - Won't stop the actual WP_Query though, just sets the 404 headers.
     40    // Pre-query, Override the query to be a 404.
    4141    public function request( $args ) {
    4242        if ( isset( $args['paged'] ) && $args['paged'] > self::MAX_PAGES ) {
    43             $args['error'] = 404;
     43            $args = array(
     44                'error' => 404,
     45            );
    4446        }
    4547        return $args;
     
    5658        if ( $paged && $paged > self::MAX_PAGES ) {
    5759            $query->set_404();
    58         /*
    59             // TODO: WP_Query will still query the DB even if it's been told it's a 404 either via set_404() or via WP::parse_request().
    60             add_filter( 'posts_request', function( $request ) {
    61                 // remove_filter( 'posts_request', __METHOD__ );
    62                 return ''; // empty SQL
    63             }, 100 );
    64         */
    6560        }
    6661
Note: See TracChangeset for help on using the changeset viewer.