diff --git a/wp-includes/classes.php b/wp-includes/classes.php index a5a3117882..9e8d88e04d 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -524,6 +524,9 @@ class WP_Query { } update_post_caches($this->posts); + + // Save any changes made to the query vars. + $this->query_vars = $q; return $this->posts; } diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index 50ece01ac1..c258f963d1 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -98,7 +98,12 @@ function get_bloginfo($show='') { function wp_title($sep = '»', $display = true) { global $wpdb; - global $m, $year, $monthnum, $day, $cat, $category_name, $p, $name, $month, $posts; + global $m, $year, $monthnum, $day, $category_name, $month, $posts; + + $cat = get_query_var('cat'); + $p = get_query_var('p'); + $name = get_query_var('name'); + $category_name = get_query_var('category_name'); // If there's a category if(!empty($cat)) { @@ -150,7 +155,9 @@ function wp_title($sep = '»', $display = true) { } function single_post_title($prefix = '', $display = true) { - global $p, $name, $wpdb; + global $wpdb; + $p = get_query_var('p'); + $name = get_query_var('name'); if (intval($p) || '' != $name) { if (!$p) { $p = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$name'"); @@ -167,7 +174,7 @@ function single_post_title($prefix = '', $display = true) { } function single_cat_title($prefix = '', $display = true ) { - global $cat; + $cat = get_query_var('cat'); if(!empty($cat) && !(strtoupper($cat) == 'ALL')) { $my_cat_name = get_the_category_by_ID($cat); if(!empty($my_cat_name)) {