Making WordPress.org

Changeset 8663


Ignore:
Timestamp:
04/24/2019 07:06:00 PM (6 years ago)
Author:
coffee2code
Message:

Developer: Return 404 response for paginated frontpage requests.

Props jonoaldersonwp, coffee2code.
Fixes #4372.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
2 edited

Legend:

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

    r556 r8663  
    55 * @package wporg-developer
    66 */
     7
     8$GLOBALS['wp_query']->set_404();
     9status_header( 404 );
    710
    811get_header(); ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/redirects.php

    r7319 r8663  
    2727        add_action( 'template_redirect', array( __CLASS__, 'redirect_singularized_handbooks' ), 1 );
    2828        add_action( 'template_redirect', array( __CLASS__, 'redirect_pluralized_reference_post_types' ), 1 );
     29        add_action( 'template_redirect', array( __CLASS__, 'paginated_home_page_404' ) );
    2930    }
    3031
     
    117118    }
    118119
     120    /**
     121     * Returns 404 response to requests for non-first pages of the front page.
     122     */
     123    public static function paginated_home_page_404() {
     124        // Paginated front page.
     125        if ( is_front_page() && is_paged() ) {
     126            include( get_stylesheet_directory() . '/404.php' );
     127            exit;
     128        }
     129    }
     130
    119131} // DevHub_Redirects
    120132
Note: See TracChangeset for help on using the changeset viewer.