WordPress.org

Make WordPress Core

Ticket #25143: 25143.4.patch

File 25143.4.patch, 1.8 KB (added by mordauk, 5 years ago)
  • src/wp-includes/rewrite.php

     
    248248 *
    249249 * @param string $name Name of the endpoint.
    250250 * @param int $places Endpoint mask describing the places the endpoint should be added.
    251  * @param string $query_var Name of the corresponding query variable. Defaults to $name.
     251 * @param bool   $add_query_var Whether or not to register the query var. Default is true.
    252252 */
    253 function add_rewrite_endpoint( $name, $places, $query_var = null ) {
     253function add_rewrite_endpoint( $name, $places, $query_var = true ) {
    254254        global $wp_rewrite;
    255255        $wp_rewrite->add_endpoint( $name, $places, $query_var );
    256256}
     
    19641964         * @see add_rewrite_endpoint() for full documentation.
    19651965         * @uses WP::add_query_var()
    19661966         *
    1967          * @param string $name      Name of the endpoint.
    1968          * @param int    $places    Endpoint mask describing the places the endpoint should be added.
    1969          * @param string $query_var Name of the corresponding query variable. Default is value of $name.
     1967         * @param string $name          Name of the endpoint.
     1968         * @param int    $places        Endpoint mask describing the places the endpoint should be added.
     1969         * @param string $query_var     Name of the corresponding query variable. Default is value of $name.
    19701970         */
    1971         public function add_endpoint( $name, $places, $query_var = null ) {
     1971        public function add_endpoint( $name, $places, $query_var = true ) {
    19721972                global $wp;
    1973                 if ( null === $query_var ) {
     1973
     1974                if ( true === $query_var ) {
    19741975                        $query_var = $name;
    19751976                }
    19761977                $this->endpoints[] = array( $places, $name, $query_var );
    1977                 $wp->add_query_var( $query_var );
     1978
     1979                if( $query_var ) {
     1980                        $wp->add_query_var( $query_var );
     1981                }
    19781982        }
    19791983
    19801984        /**