Changeset 15848 for trunk/wp-includes/query.php
- Timestamp:
- 10/19/2010 10:27:34 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r15843 r15848 3147 3147 global $wpdb; 3148 3148 3149 $query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND meta_key = '_wp_old_slug' AND meta_value=%s", $wp_query->query_vars['name']); 3149 // Guess the current post_type based on the query vars. 3150 if ( get_query_var('post_type') ) 3151 $post_type = get_query_var('post_type'); 3152 elseif ( !empty($wp_query->query_vars['pagename']) ) 3153 $post_type = 'page'; 3154 else 3155 $post_type = 'post'; 3156 3157 $query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']); 3150 3158 3151 3159 // if year, monthnum, or day have been specified, make our query more precise
Note: See TracChangeset
for help on using the changeset viewer.