Make WordPress Core

Ticket #35031: 35031.3.diff

File 35031.3.diff, 1.1 KB (added by dd32, 9 years ago)
  • src/wp-includes/query.php

    class WP_Query { 
    49454945
    49464946/**
    49474947 * Redirect old slugs to the correct permalink.
    49484948 *
    49494949 * Attempts to find the current slug from the past slugs.
    49504950 *
    49514951 * @since 2.1.0
    49524952 *
    49534953 * @global WP_Query   $wp_query   Global WP_Query instance.
    49544954 * @global wpdb       $wpdb       WordPress database abstraction object.
    49554955 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
    49564956 */
    49574957function wp_old_slug_redirect() {
    49584958        global $wp_query, $wp_rewrite;
    49594959
     4960        if ( get_queried_object() ) {
     4961                return;
     4962        }
     4963
    49604964        if ( '' !== $wp_query->query_vars['name'] ) :
    49614965                global $wpdb;
    49624966
    49634967                // Guess the current post_type based on the query vars.
    49644968                if ( get_query_var( 'post_type' ) ) {
    49654969                        $post_type = get_query_var( 'post_type' );
    49664970                } elseif ( get_query_var( 'attachment' ) ) {
    49674971                        $post_type = 'attachment';
    49684972                } elseif ( ! empty( $wp_query->query_vars['pagename'] ) ) {
    49694973                        $post_type = 'page';
    49704974                } else {
    49714975                        $post_type = 'post';
    49724976                }
    49734977
    49744978                if ( is_array( $post_type ) ) {