Introduce add_permastruct() and flush_rewrite_rules(), wrappers for the corresponding WP_Rewrite methods. Fixes #10912 props scribu
git-svn-id: http://svn.automattic.com/wordpress/trunk@13438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
90fe1465d3
commit
1ef299159c
|
@ -45,6 +45,21 @@ function add_rewrite_tag($tagname, $regex) {
|
||||||
$wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
|
$wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add permalink structure.
|
||||||
|
*
|
||||||
|
* @see WP_Rewrite::add_permastruct()
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param string $name Name for permalink structure.
|
||||||
|
* @param string $struct Permalink structure.
|
||||||
|
* @param bool $with_front Prepend front base to permalink structure.
|
||||||
|
*/
|
||||||
|
function add_permastruct( $name, $struct, $with_front = true ) {
|
||||||
|
global $wp_rewrite;
|
||||||
|
return $wp_rewrite->add_permastruct( $name, $struct, $with_front );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new feed type like /atom1/.
|
* Add a new feed type like /atom1/.
|
||||||
*
|
*
|
||||||
|
@ -66,6 +81,20 @@ function add_feed($feedname, $function) {
|
||||||
return $hook;
|
return $hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove rewrite rules and then recreate rewrite rules.
|
||||||
|
*
|
||||||
|
* @see WP_Rewrite::flush_rules()
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param bool $hard Whether to update .htaccess (hard flush) or just update
|
||||||
|
* rewrite_rules transient (soft flush). Default is true (hard).
|
||||||
|
*/
|
||||||
|
function flush_rewrite_rules( $hard = true ) {
|
||||||
|
global $wp_rewrite;
|
||||||
|
$wp_rewrite->flush_rules( $hard );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Endpoint Mask for Permalink.
|
* Endpoint Mask for Permalink.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue