From: Chuck Scott Date: Tue, 30 Aug 2016 15:36:32 +0000 (-0400) Subject: Testing fix for 404s on detail pages X-Git-Tag: v2.5.4^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=bab2c176b07073df0a41a9f75d65812c948a1f0b;p=WP-Plugins%2Fglm-member-db.git Testing fix for 404s on detail pages --- diff --git a/setup/frontHooks.php b/setup/frontHooks.php index b52eed71..28d181f2 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -26,6 +26,24 @@ * Also note that parameters will be in the context of the main front controller constructor. */ +// Setup rewrite for member detail pages +add_filter('rewrite_rules_array', function($rules) { + + // Check if rule is not set + if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$'] ) ) { + + // Add the new rule + $newrules = array(); + $newrules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$']='index.php?pagename=$matches[1]&memberslug=$matches[2]'; + return $newrules + $rules; + } + + // If already set, just return the rules unchanged. + return $rules; + +}); + +/* This code is being replace for testing by the above to avoid intermittent 404's on the detail pages. // Check if the canonical member page rewrite rule is not currently in place. $rules = get_option( 'rewrite_rules' ); if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/([^/]*)$'] ) ) { @@ -44,6 +62,7 @@ if ( ! isset( $rules['('.$this->config['settings']['canonical_member_page'].')/( }); } +*/ /* * Add a filter to correct rel_canonical header entries