Advertisement
Guest User

WP Flush Rewrites 404 Permalink WordPress

a guest
Jan 20th, 2011
2,743
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2. function ds_flush_blogs_rewrite($blog) {
  3.     global $wp_rewrite;
  4.        
  5.     switch_to_blog($blog);
  6.     $wp_rewrite->flush_rules();
  7.     restore_current_blog();
  8. }
  9.  
  10. function update_siteurl() {
  11.     global $wpdb;
  12.    
  13.     $sites = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->blogs"));
  14.    
  15.     foreach ( $sites as $site ) {
  16.         $id = $site->blog_id;
  17.         ds_flush_blogs_rewrite($id);
  18.         $url = get_site_url($site->blog_id);
  19.         update_blog_option($id,'siteurl',$url);
  20.         update_blog_option($id,'home',$url);
  21.     }  
  22. }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement