WordPress.org

Making WordPress.org

Changeset 6498


Ignore:
Timestamp:
02/01/2018 06:18:31 AM (19 months ago)
Author:
dd32
Message:

Theme Directory: Add a redirect for wordpress.org/themes to wordpress.org/themes/.
This would normally be handled by WordPress redirect_canonical() but we have that disabled on the Theme Directory.

Fixes #1543.

File:
1 edited

Legend:

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

    r6473 r6498  
    2727    remove_action( 'template_redirect', 'wp_old_slug_redirect' );
    2828
     29    add_action( 'template_redirect', 'wporg_themes_trailing_slashes' );
     30
    2931    add_theme_support( 'wp4-styles' );
    3032}
    3133add_action( 'after_setup_theme', 'wporg_themes_setup' );
     34
     35/**
     36 * Handle the root-level redirect to trailing-slash'd uri which redirect_canonical() usually does.
     37 */
     38function wporg_themes_trailing_slashes() {
     39    if ( '/themes' === $_SERVER['REQUEST_URI'] ) {
     40        wp_safe_redirect( '/themes/' );
     41        die();
     42    }
     43}
    3244
    3345/**
Note: See TracChangeset for help on using the changeset viewer.