开发者

I need to change the Wordpress wp_ prefix to stop conflicts with other site on server

开发者 https://www.devze.com 2023-03-17 19:34 出处:网络
I\'ve developed a client\'s site in Wordpress and used multiple plugins. I\'ve come to the stage where I need to copy the site to the clients server, but there\'s already a Wordpress blog on it (using

I've developed a client's site in Wordpress and used multiple plugins. I've come to the stage where I need to copy the site to the clients server, but there's already a Wordpress blog on it (using the prefix wp_). I've read that whilst installing WP you can choose a different prefix for tables on the same DB as other WP builds (ie. 'wp_' to 'new_wp_'), however I wasn't aware of this other site when I started building the site for the client.

So now I need to change the prefix of my site's files site-wide, and I'm having issues. Has anyone come across thi开发者_运维百科s problem before, and if so what's the solution? I very much want to avoid having to do a fresh install, as I've done a lot of work in the admin section with plugins etc.

Any help would be great :)

Dalogi


I've used the walk through at this link a few times to move/change the prefixes in the database for a live site or a move from localhost to live; it looks old, but they still work, according to the comments: http://tdot-blog.com/wordpress/6-simple-steps-to-change-your-table-prefix-in-wordpress

If you somehow have hardcoded links in theme files, you need to change those manually.

There is a plugin or two that also does the database table change: http://wordpress.org/extend/plugins/better-wp-security/


See wp-includes/wp-db.php

$table_prefix = wpdb::get_blog_prefix();

And use that, instead of hard-coding it.


According to the WordPress codex entry Installing Multiple blogs, you need to set the $table_prefix value in the wp.config file.

$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_' 

I've installed multiple WP instances using the same db with this method, and have never gotten a database conflict.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号