Ticket #20905: 20905.patch
File 20905.patch, 1.7 KB (added by , 12 years ago) |
---|
-
wp-includes/rewrite.php
243 243 * 244 244 * @param string $name Name of the endpoint. 245 245 * @param int $places Endpoint mask describing the places the endpoint should be added. 246 * @param string $query_var Name of the corresponding query variable. Defaults to $name. 246 247 */ 247 function add_rewrite_endpoint( $name, $places ) {248 function add_rewrite_endpoint( $name, $places, $query_var = null ) { 248 249 global $wp_rewrite; 249 $wp_rewrite->add_endpoint( $name, $places );250 $wp_rewrite->add_endpoint( $name, $places, $query_var ); 250 251 } 251 252 252 253 /** … … 1246 1247 //match everything after the endpoint name, but allow for nothing to appear there 1247 1248 $epmatch = $endpoint[1] . '(/(.*))?/?$'; 1248 1249 //this will be appended on to the rest of the query for each dir 1249 $epquery = '&' . $endpoint[ 1] . '=';1250 $epquery = '&' . $endpoint[2] . '='; 1250 1251 $ep_query_append[$epmatch] = array ( $endpoint[0], $epquery ); 1251 1252 } 1252 1253 } … … 1863 1864 * 1864 1865 * @param string $name Name of the endpoint. 1865 1866 * @param int $places Endpoint mask describing the places the endpoint should be added. 1867 * @param string $query_var Name of the corresponding query variable. Defaults to $name. 1866 1868 */ 1867 function add_endpoint( $name, $places) {1869 function add_endpoint( $name, $places, $query_var = null ) { 1868 1870 global $wp; 1869 $this->endpoints[] = array ( $places, $name ); 1870 $wp->add_query_var($name); 1871 if ( empty( $query_var ) ) 1872 $query_var = $name; 1873 $this->endpoints[] = array ( $places, $name, $query_var ); 1874 $wp->add_query_var( $query_var ); 1871 1875 } 1872 1876 1873 1877 /**