WordPress.org

Make WordPress Core

Ticket #25143: 25143.3.patch

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

     
    249249 * @param string $name Name of the endpoint.
    250250 * @param int $places Endpoint mask describing the places the endpoint should be added.
    251251 * @param string $query_var Name of the corresponding query variable. Defaults to $name.
     252 * @param bool   $add_query_var Whether or not to register the query var. Default is true.
    252253 */
    253 function add_rewrite_endpoint( $name, $places, $query_var = null ) {
     254function add_rewrite_endpoint( $name, $places, $query_var = null, $add_query_var = true ) {
    254255        global $wp_rewrite;
    255         $wp_rewrite->add_endpoint( $name, $places, $query_var );
     256        $wp_rewrite->add_endpoint( $name, $places, $query_var, $add_query_var );
    256257}
    257258
    258259/**
     
    19641965         * @see add_rewrite_endpoint() for full documentation.
    19651966         * @uses WP::add_query_var()
    19661967         *
    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.
     1968         * @param string $name          Name of the endpoint.
     1969         * @param int    $places        Endpoint mask describing the places the endpoint should be added.
     1970         * @param string $query_var     Name of the corresponding query variable. Default is value of $name.
     1971         * @param bool   $add_query_var Whether or not to register the query var. Default is true.
    19701972         */
    1971         public function add_endpoint( $name, $places, $query_var = null ) {
     1973        public function add_endpoint( $name, $places, $query_var = null, $add_query_var = true ) {
    19721974                global $wp;
    19731975                if ( null === $query_var ) {
    19741976                        $query_var = $name;
    19751977                }
    19761978                $this->endpoints[] = array( $places, $name, $query_var );
    1977                 $wp->add_query_var( $query_var );
     1979
     1980                if( $add_query_var ) {
     1981                        $wp->add_query_var( $query_var );
     1982                }
    19781983        }
    19791984
    19801985        /**