diff --git a/src/wp-includes/rewrite.php b/src/wp-includes/rewrite.php
index 67dade3..5aa8777 100644
a
|
b
|
function add_rewrite_rule($regex, $redirect, $after = 'bottom') { |
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
| 25 | * Remove a rewrite rule. |
| 26 | * |
| 27 | * @see WP_Rewrite::add_rule() for long description. |
| 28 | * @since 4.0.0 |
| 29 | * |
| 30 | * @param string $regex Regular Expression to match request against. |
| 31 | * @param string $redirect Page to redirect to. |
| 32 | * @param string $after Optional, default is 'bottom'. Where to add rule, can also be 'top'. |
| 33 | */ |
| 34 | function remove_rewrite_rule($regex, $redirect, $after = 'bottom') { |
| 35 | global $wp_rewrite; |
| 36 | $wp_rewrite->remove_rule($regex, $redirect, $after); |
| 37 | } |
| 38 | |
| 39 | /** |
25 | 40 | * Add a new rewrite tag (like %postname%). |
26 | 41 | * |
27 | 42 | * The $query parameter is optional. If it is omitted you must ensure that |
… |
… |
class WP_Rewrite { |
1938 | 1953 | } |
1939 | 1954 | |
1940 | 1955 | /** |
| 1956 | * Remove a rewrite rule. |
| 1957 | * |
| 1958 | * @since 4.0.0 |
| 1959 | * @access public |
| 1960 | * |
| 1961 | * @param string $regex Regular expression to match against request. |
| 1962 | * @param string $redirect URL regex redirects to when regex matches request. |
| 1963 | * @param string $after Optional, default is bottom. Location to place rule. |
| 1964 | */ |
| 1965 | public function remove_rule($regex, $redirect, $after = 'bottom' ) { |
| 1966 | $strpos_to_end_of_filename_of_regex = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?')); |
| 1967 | $front = substr($redirect, 0, $strpos_to_end_of_filename_of_regex); |
| 1968 | if ( $front != $this->index ) { //it doesn't redirect to WP's index.php |
| 1969 | $this->remove_external_rule( $regex, $redirect ); |
| 1970 | } else { |
| 1971 | if ( 'bottom' == $after ) { |
| 1972 | unset( $this->extra_rules[$regex] ); |
| 1973 | } else { |
| 1974 | unset( $this->extra_rules_top[$regex] ); |
| 1975 | } |
| 1976 | } |
| 1977 | } |
| 1978 | |
| 1979 | /** |
1941 | 1980 | * Add a rule that doesn't redirect to index.php. |
1942 | 1981 | * |
1943 | 1982 | * Can redirect to any place. |
… |
… |
class WP_Rewrite { |
1953 | 1992 | } |
1954 | 1993 | |
1955 | 1994 | /** |
| 1995 | * Remove a rule that doesn't redirect to index.php. |
| 1996 | * |
| 1997 | * @since 4.0.0 |
| 1998 | * @access public |
| 1999 | * |
| 2000 | * @param string $regex Regular expression to match against request. |
| 2001 | * @param string $redirect URL regex redirects to when regex matches request. |
| 2002 | */ |
| 2003 | public function remove_external_rule( $regex, $redirect ) { |
| 2004 | unset( $this->non_wp_rules[$regex] ); |
| 2005 | } |
| 2006 | |
| 2007 | /** |
1956 | 2008 | * Add an endpoint, like /trackback/. |
1957 | 2009 | * |
1958 | 2010 | * @since 2.1.0 |