Ticket #35031: 35031.3.diff
File 35031.3.diff, 1.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/query.php
class WP_Query { 4945 4945 4946 4946 /** 4947 4947 * Redirect old slugs to the correct permalink. 4948 4948 * 4949 4949 * Attempts to find the current slug from the past slugs. 4950 4950 * 4951 4951 * @since 2.1.0 4952 4952 * 4953 4953 * @global WP_Query $wp_query Global WP_Query instance. 4954 4954 * @global wpdb $wpdb WordPress database abstraction object. 4955 4955 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. 4956 4956 */ 4957 4957 function wp_old_slug_redirect() { 4958 4958 global $wp_query, $wp_rewrite; 4959 4959 4960 if ( get_queried_object() ) { 4961 return; 4962 } 4963 4960 4964 if ( '' !== $wp_query->query_vars['name'] ) : 4961 4965 global $wpdb; 4962 4966 4963 4967 // Guess the current post_type based on the query vars. 4964 4968 if ( get_query_var( 'post_type' ) ) { 4965 4969 $post_type = get_query_var( 'post_type' ); 4966 4970 } elseif ( get_query_var( 'attachment' ) ) { 4967 4971 $post_type = 'attachment'; 4968 4972 } elseif ( ! empty( $wp_query->query_vars['pagename'] ) ) { 4969 4973 $post_type = 'page'; 4970 4974 } else { 4971 4975 $post_type = 'post'; 4972 4976 } 4973 4977 4974 4978 if ( is_array( $post_type ) ) {