Split tag names by [\r\n\t ] rather than \s to avoid that character class from eating characters. props rstern, SergeyBiryukov. fixes #21779. see #13413.
git-svn-id: http://core.svn.wordpress.org/trunk@21862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4c64b3a4b9
commit
2a4fc8952f
|
@ -1787,13 +1787,13 @@ class WP_Query {
|
||||||
// Tag stuff
|
// Tag stuff
|
||||||
if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) {
|
if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) {
|
||||||
if ( strpos($q['tag'], ',') !== false ) {
|
if ( strpos($q['tag'], ',') !== false ) {
|
||||||
$tags = preg_split('/[,\s]+/', $q['tag']);
|
$tags = preg_split('/[,\r\n\t ]+/', $q['tag']);
|
||||||
foreach ( (array) $tags as $tag ) {
|
foreach ( (array) $tags as $tag ) {
|
||||||
$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
|
$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
|
||||||
$q['tag_slug__in'][] = $tag;
|
$q['tag_slug__in'][] = $tag;
|
||||||
}
|
}
|
||||||
} else if ( preg_match('/[+\s]+/', $q['tag']) || !empty($q['cat']) ) {
|
} else if ( preg_match('/[+\r\n\t ]+/', $q['tag']) || !empty($q['cat']) ) {
|
||||||
$tags = preg_split('/[+\s]+/', $q['tag']);
|
$tags = preg_split('/[+\r\n\t ]+/', $q['tag']);
|
||||||
foreach ( (array) $tags as $tag ) {
|
foreach ( (array) $tags as $tag ) {
|
||||||
$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
|
$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
|
||||||
$q['tag_slug__and'][] = $tag;
|
$q['tag_slug__and'][] = $tag;
|
||||||
|
|
Loading…
Reference in New Issue