From: Chuck Scott Date: Tue, 30 Aug 2016 16:15:29 +0000 (-0400) Subject: Testing changes in frontHooks.php to correct intermittant package detail pages. X-Git-Tag: v1.1.15^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=938a1b12d32d0d2abafdec4d3c683650658b8e93;p=WP-Plugins%2Fglm-member-db-packaging.git Testing changes in frontHooks.php to correct intermittant package detail pages. --- diff --git a/setup/frontHooks.php b/setup/frontHooks.php index 675bf00..18c01aa 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_package_page'].')/([^/]*)$'] ) ) { + + // Add the new rule + $newrules = array(); + $newrules['('.$this->config['settings']['canonical_package_page'].')/([^/]*)$']='index.php?pagename=$matches[1]&packageslug=$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 package page rewrite rule is not currently in place. $rules = get_option( 'rewrite_rules' ); if ( ! isset( $rules['('.$this->config['settings']['canonical_package_page'].')/([^/]*)$'] ) ) { @@ -44,6 +62,7 @@ if ( ! isset( $rules['('.$this->config['settings']['canonical_package_page'].')/ }); } +*/ /* * Package Detail Page Canonical URL Fix