Add filter flush_rewrite_rules_hard to give devs chance to prevent writing to file when hard-flushing rewrite rules.

Props jeremyfelt, nacin.
Fixes #23491.



git-svn-id: https://develop.svn.wordpress.org/trunk@25328 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2013-09-10 22:18:21 +00:00
parent a98660d517
commit 4fccea305f

View File

@ -1893,9 +1893,11 @@ class WP_Rewrite {
function flush_rules($hard = true) {
delete_option('rewrite_rules');
$this->wp_rewrite_rules();
if ( $hard && function_exists('save_mod_rewrite_rules') )
if ( ! $hard || ! apply_filters( 'flush_rewrite_rules_hard', true ) )
return;
if ( function_exists( 'save_mod_rewrite_rules' ) )
save_mod_rewrite_rules();
if ( $hard && function_exists('iis7_save_url_rewrite_rules') )
if ( function_exists( 'iis7_save_url_rewrite_rules' ) )
iis7_save_url_rewrite_rules();
}