From e122f6d181e333aa1b1d7fd88cba30f98580565c Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 26 Feb 2010 19:23:58 +0000 Subject: [PATCH] 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 --- wp-includes/rewrite.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/wp-includes/rewrite.php b/wp-includes/rewrite.php index 30a784eb8a..7c6b735ee0 100644 --- a/wp-includes/rewrite.php +++ b/wp-includes/rewrite.php @@ -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. *