From 121c9615e1105759534219efc0cde148a93a4a43 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 12 Jan 2011 21:44:47 +0000 Subject: [PATCH] Resurrect 'tag' query processing. see #16157 git-svn-id: http://svn.automattic.com/wordpress/trunk@17272 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wp-includes/query.php b/wp-includes/query.php index d954e8a889..66867afb63 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1735,6 +1735,25 @@ class WP_Query { } // Tag stuff + if ( '' != $q['tag'] && !$this->is_singular && !$this->parsed_tax_query ) { + if ( strpos($q['tag'], ',') !== false ) { + $tags = preg_split('/[,\s]+/', $q['tag']); + foreach ( (array) $tags as $tag ) { + $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); + $q['tag_slug__in'][] = $tag; + } + } else if ( preg_match('/[+\s]+/', $q['tag']) || !empty($q['cat']) ) { + $tags = preg_split('/[+\s]+/', $q['tag']); + foreach ( (array) $tags as $tag ) { + $tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db'); + $q['tag_slug__and'][] = $tag; + } + } else { + $q['tag'] = sanitize_term_field('slug', $q['tag'], 0, 'post_tag', 'db'); + $q['tag_slug__in'][] = $q['tag']; + } + } + if ( !empty($q['tag_id']) ) { $q['tag_id'] = absint( $q['tag_id'] ); $tax_query[] = array(