Introduce add_permastruct() and flush_rewrite_rules(), wrappers for the corresponding WP_Rewrite methods. Fixes #10912 props scribu

git-svn-id: https://develop.svn.wordpress.org/trunk@13438 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-02-26 19:23:58 +00:00
parent d2cfae455e
commit e122f6d181
1 changed files with 29 additions and 0 deletions

View File

@ -45,6 +45,21 @@ function add_rewrite_tag($tagname, $regex) {
$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/.
*
@ -66,6 +81,20 @@ function add_feed($feedname, $function) {
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.
*