Testing fix for 404s on detail pages
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 30 Aug 2016 15:36:32 +0000 (11:36 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 30 Aug 2016 15:36:32 +0000 (11:36 -0400)
setup/frontHooks.php

index b52eed7..28d181f 100644 (file)
  *  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