Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite rules are flushed incorrectly for multisite. #73

Open
jeremyfelt opened this issue Jul 18, 2015 · 0 comments
Open

Rewrite rules are flushed incorrectly for multisite. #73

jeremyfelt opened this issue Jul 18, 2015 · 0 comments
Labels

Comments

@jeremyfelt
Copy link

$mu_blogs = wp_get_sites();
foreach ( $mu_blogs as $mu_blog ) {
    switch_to_blog( $mu_blog['blog_id'] );
    json_oauth_server_register_rewrites();
    flush_rewrite_rules();
}
restore_current_blog();

This line will (may?) result in each site on the network inheriting the rewrite rules of the main site. Or the first 100 due to the default limit on wp_get_sites().

delete_option( 'rewrite_rules' ); would be a replacement, but things get ugly when there's a bunch of sites. 😞

It may be best to just put up a notice in the network admin instead explaining that rewrites need to be flushed manually.

Also, restore_current_blog() only goes up one level in the stack. That should live in the foreach() or there should be a while( ms_is_switched() ).

Sorry, walking out the door and didn't have time to put together a proper PR. 🌟 💥

@joehoyle joehoyle added the Bug label Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants