Making WordPress.org

Changeset 8200


Ignore:
Timestamp:
02/05/2019 08:32:20 AM (6 years ago)
Author:
dd32
Message:

WordPress.org: Add some redirects for about pages which no longer exist.

Fixes #4069.

File:
1 edited

Legend:

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

    r7897 r8200  
    230230
    231231/**
     232 * Some custom redirects for old pages no longer included in this theme.
     233 */
     234function old_page_redirects() {
     235    if ( ! is_404() ) {
     236        return;
     237    }
     238
     239    // Old WordPress.org/about/* pages:
     240    if (
     241        'wordpress.org' == $_SERVER['HTTP_HOST'] &&
     242        preg_match( '!^/about/(books|fanart|screenshots)!i', $_SERVER['REQUEST_URI'] )
     243    ) {
     244        wp_safe_redirect( '/about/', 301 );
     245        die();
     246    }
     247}
     248add_filter( 'template_redirect', __NAMESPACE__ . '\old_page_redirects' );
     249
     250/**
    232251 * Custom template tags.
    233252 */
Note: See TracChangeset for help on using the changeset viewer.