Make WordPress Core

Ticket #39120: 39120.term-query.2.patch

File 39120.term-query.2.patch, 1.1 KB (added by birgire, 7 years ago)

Default as null instead of empty string for $default

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

     
    959959
    960960                return $wpdb->prepare( '((t.name LIKE %s) OR (t.slug LIKE %s))', $like, $like );
    961961        }
     962
     963        /**
     964         * Retrieve query variable.
     965         *
     966         * @since 4.9.0
     967         *
     968         * @access public
     969         *
     970         * @param string $query_var Query variable key.
     971         * @param mixed  $default   Optional. Value to return if the query variable is not set. Default null.
     972         * @return mixed            Contents of the query variable.
     973         */
     974        public function get( $query_var, $default = null ) {
     975                if ( isset( $this->query_vars[ $query_var ] ) ) {
     976                        return $this->query_vars[ $query_var ];
     977                }
     978
     979                return $default;
     980        }
     981
     982        /**
     983         * Set query variable.
     984         *
     985         * @since 4.9.0
     986         * @access public
     987         *
     988         * @param string $query_var Query variable key.
     989         * @param mixed  $value     Query variable value.
     990         */
     991        public function set( $query_var, $value ) {
     992                $this->query_vars[$query_var] = $value;
     993        }
    962994}