Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#33984 closed defect (bug) (invalid)

Wp_Query on tag & category based posts not getting when use + sign.

Reported by: ravipatel's profile ravipatel Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2.1
Component: Query Keywords:
Focuses: template Cc:

Description

https://wordpress.org/support/topic/wp_query-on-tag-based-not-getting-post-when-use-sign

$query = new WP_Query( 'category_name=facebook,uncategorized' ); (work)

$query = new WP_Query( 'category_name=facebook+uncategorized' );(Not work) 

Our support Question. We have testing code by developers get issue this technique not working please review and change on web.

Change History (2)

#1 @Clorith
9 years ago

  • Focuses docs performance removed
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version changed from 4.3.1 to 2.2.1

It seems that since we run parse_str when the value is submitted as a string (as opposed to an array), the + sign is omitted as a space, using the URL Encoded variant of it %2B produces the expected result, as does providing the WP_Query arguments as an array new WP_Query( array( 'category_name' => 'facebook+uncategorized' ) );

Since this is the behavior of parse_str, a native PHP function, I'm going to suggest this isn't something we can (or should be) messing with as it might break expected backwards compatibility for other existing implementations

#2 @ocean90
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution changed from wontfix to invalid

The category_name is the slug of a category which can't contain a plus sign.

Note: See TracTickets for help on using tickets.