Getting 404 after visiting activity stream in buddypress
-
Continuing thread from wordpress.org:
Anytime I navigate to the activity feed on buddypress and then back to a main page in my navigation I receive a 404 page not found. I can reset the issue by re-saving permalink settings.
After troubleshooting I discovered that the in the wordpress parse_request function, a different rewrite rule is being matched when it breaks. When it is not working the regexp ([^/]+)(/[0-9]+)?/?$ is matched.
request uri:string(21) “mindfulness-resources”
new match: ([^/]+)(/[0-9]+)?/?$ Query: index.php?name=$matches[1]&page=$matches[2]array(2) {
[0]=>
string(21) “mindfulness-resources”
[1]=>
string(21) “mindfulness-resources”
}When it is working the same block returns the output below and (.?.+?)(/[0-9]+)?/?$ is matched.:
request uri:string(21) “mindfulness-resources”
new match: (.?.+?)(/[0-9]+)?/?$ Query: index.php?pagename=$matches[1]&page=$matches[2]array(2) {
[0]=>
string(21) “mindfulness-resources”
[1]=>
string(21) “mindfulness-resources”
}The only two differences I can detect is that the rewrite array order is different for these two rules and when its working the (.?.+?)(/[0-9]+)?/?$ rule is higher and thus encountered by the rule matching loop first. I have not been able to find the reason the order changes.
I fixed this by adding the following lines to wp-includes/class-wp.php which is not an ideal solution
if(isset($rewrite['([^/]+)(/[0-9]+)?/?$'])) { $temp = $rewrite['([^/]+)(/[0-9]+)?/?$']; unset($rewrite['([^/]+)(/[0-9]+)?/?$']); $rewrite['([^/]+)(/[0-9]+)?/?$'] = $temp; }
right after the line below in the function parse_request().
// Fetch the rewrite rules. $rewrite = $wp_rewrite->wp_rewrite_rules();
- The topic ‘Getting 404 after visiting activity stream in buddypress’ is closed to new replies.