Advertisement
spiraliwebstudio

Wordpress DB transfer

Jun 16th, 2012
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. define('WP_USE_THEMES', false);
  4.  
  5. require('./wp-config.php');
  6.  
  7. $old_prefix = 'wp_';
  8.  
  9. global $wpdb;
  10. $wpdb->query( "UPDATE `$wpdb->usermeta`
  11.     SET `meta_key` = REPLACE( `meta_key` , '$old_prefix', '$wpdb->prefix' )
  12.     WHERE `meta_key` LIKE '" . addcslashes( $old_prefix, '_' ) . "%'" );
  13.  
  14. $wpdb->query( "UPDATE `$wpdb->options`
  15.     SET `option_name` = '{$wpdb->prefix}user_roles'
  16.     WHERE `option_name` = '{$old_prefix}user_roles' AND `blog_id` = 0" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement