From 02a4f9875d50c7002eeed3e1880f6b0d7e3b8640 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 14 Apr 2017 12:48:53 -0400 Subject: [PATCH] Combining with above check for rewrite Don't flush twice --- setup/frontHooks.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/setup/frontHooks.php b/setup/frontHooks.php index 3ee03cb1..0e404f7c 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -44,12 +44,9 @@ add_filter( 'query_vars', function($vars) { }); add_action('wp_loaded', function() { $rules = get_option('rewrite_rules'); - if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$'] ) ) { - trigger_error('Doing rewrite flush - Member detail page', E_USER_NOTICE); // Logging that this is happening so we can track when that happens. - global $wp_rewrite; - $wp_rewrite->flush_rules(); - } - if ( isset( $this->config['settings']['enable_multiple_profiles'] ) && $this->config['settings']['enable_multiple_profiles'] && ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/([^/]*)$'] ) ) { + if ( !isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$'] ) || + ( ( isset( $this->config['settings']['enable_multiple_profiles'] ) && $this->config['settings']['enable_multiple_profiles'] ) && !isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)/([^/]*)$'] ) ) + ) { trigger_error('Doing rewrite flush - Member detail page', E_USER_NOTICE); // Logging that this is happening so we can track when that happens. global $wp_rewrite; $wp_rewrite->flush_rules(); -- 2.17.1