From: Steve Sutton Date: Fri, 14 Apr 2017 16:48:53 +0000 (-0400) Subject: Combining with above check for rewrite X-Git-Tag: v2.9.15^2~23 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=02a4f9875d50c7002eeed3e1880f6b0d7e3b8640;p=WP-Plugins%2Fglm-member-db.git Combining with above check for rewrite Don't flush twice --- 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();