diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 5b1ab37b6..3e8a6e493 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -120,6 +120,10 @@ if (isset($plugin_page)) { include(ABSPATH . 'wp-admin/admin-footer.php'); + // Make sure rules are flushed + global $wp_rewrite; + $wp_rewrite->flush_rules(); + exit(); } else { do_action("load-$pagenow"); diff --git a/wp-includes/post.php b/wp-includes/post.php index e4eb12bb1..71a2b1835 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3112,8 +3112,11 @@ function _publish_post_hook($post_id) { function _save_post_hook($post_id, $post) { if ( $post->post_type == 'page' ) { clean_page_cache($post_id); - global $wp_rewrite; - $wp_rewrite->flush_rules(); + // Avoid flushing rules for every post during import. + if ( !defined('WP_IMPORTING') ) { + global $wp_rewrite; + $wp_rewrite->flush_rules(); + } } else { clean_post_cache($post_id); }