Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 3 years ago

#26665 closed defect (bug) (duplicate)

Exception is thrown on line query.php on line 1758 Warning: strpos() expects parameter 1 to be string

Reported by: syntaxart Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Query Keywords:
Focuses: Cc:


This exception is thrown when submitting a url such as http://testing.dev/vacancy/?country[]=australia&country[]=new-zealand

What is trying to be acheived?

I am trying to submit multiple terms per taxonomy using a checkbox list of values with the name set to name="country[]". The tax_query successfully works but an exception is printed to the window.

I have created a fix on my local machine which is to wrap the nested statement with

if (!is_array($term)) {
                    if (strpos($term, '+') !== false) {
                        $terms = preg_split('/[+]+/', $term);
                        foreach ($terms as $term) {
                            $tax_query[] = array_merge($tax_query_defaults, array(
                                'terms' => array($term)
                    } else {
                        $tax_query[] = array_merge($tax_query_defaults, array(
                            'terms' => preg_split('/[,]+/', $term)

I also used the plugin Taxonomy Picker to test multiple selected terms, and the same exception is thrown.

Thank you very much for looking into this bug.



Change History (1)

#1 @SergeyBiryukov
8 years ago

  • Component changed from General to Query
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #26308 and #17737.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.