Make WordPress Core

Ticket #60055: 60055.01.diff

File 60055.01.diff, 1.1 KB (added by dcavins, 3 years ago)

Change cleanup logic depending on whether query variable is a string or an array.

  • src/wp-includes/class-wp.php

    diff --git src/wp-includes/class-wp.php src/wp-includes/class-wp.php
    index ce88c102cf..59a5fb4ca7 100644
    class WP {  
    356356                // Convert urldecoded spaces back into '+'.
    357357                foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy => $t ) {
    358358                        if ( $t->query_var && isset( $this->query_vars[ $t->query_var ] ) ) {
    359                                 $this->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->query_vars[ $t->query_var ] );
     359                                // Query vars passed via REST API can be an array after r50157.
     360                                if ( is_string( $this->query_vars[ $t->query_var ] ) ) {
     361                                        $this->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->query_vars[ $t->query_var ] );
     362                                } else if ( is_array( $this->query_vars[ $t->query_var ] ) && isset( $this->query_vars[ $t->query_var ]['terms'] ) && is_array( $this->query_vars[ $t->query_var ]['terms'] ) ) {
     363                                        foreach ( $this->query_vars[ $t->query_var ]['terms'] as $key => $term ) {
     364                                                $this->query_vars[ $t->query_var ]['terms'][ $key ] = str_replace( ' ', '+', $term );
     365                                        }
     366                                }
    360367                        }
    361368                }
    362369