Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

WP Flush Rewrites 404 Permalink WordPress

By: a guest on Jan 20th, 2011  |  syntax: PHP  |  size: 0.50 KB  |  views: 1,191  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. ?>
clone this paste RAW Paste Data