Ticket #16840: 16840.diff
| File 16840.diff, 1.7 KB (added by , 15 years ago) |
|---|
-
wp-includes/rewrite.php
13 13 * @since 2.1.0 14 14 * 15 15 * @param string $regex Regular Expression to match request against. 16 * @param string $redirect Page to redirect to.16 * @param string|array $redirect Page to redirect to. 17 17 * @param string $after Optional, default is 'bottom'. Where to add rule, can also be 'top'. 18 18 */ 19 19 function add_rewrite_rule($regex, $redirect, $after = 'bottom') { … … 1791 1791 * @access public 1792 1792 * 1793 1793 * @param string $regex Regular expression to match against request. 1794 * @param string $redirect URL regex redirects to when regex matches request.1794 * @param string|array $redirect URL regex redirects to when regex matches request. 1795 1795 * @param string $after Optional, default is bottom. Location to place rule. 1796 1796 */ 1797 1797 function add_rule($regex, $redirect, $after = 'bottom') { 1798 //get everything up to the first ? 1799 $index = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?')); 1800 $front = substr($redirect, 0, $index); 1801 if ( $front != $this->index ) { //it doesn't redirect to WP's index.php 1798 if ( is_array( $redirect ) ) { 1799 $external = false; 1800 $redirect = add_query_arg( $redirect, 'index.php' ); 1801 } else { 1802 // get everything up to the first '?' 1803 $index = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?')); 1804 $front = substr($redirect, 0, $index); 1805 1806 $external = $front != $this->index; 1807 } 1808 1809 if ( $external ) { //it doesn't redirect to WP's index.php 1802 1810 $this->add_external_rule($regex, $redirect); 1803 1811 } else { 1804 1812 if ( 'bottom' == $after)