sixtysticks
sixtysticks

Reputation: 816

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

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 this 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

Upvotes: 0

Views: 458

Answers (3)

markratledge
markratledge

Reputation: 17561

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/

Upvotes: 1

Michael Paulukonis
Michael Paulukonis

Reputation: 9100

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.

Upvotes: 0

Glen Solsberry
Glen Solsberry

Reputation: 12320

See wp-includes/wp-db.php

$table_prefix = wpdb::get_blog_prefix();

And use that, instead of hard-coding it.

Upvotes: 0

Related Questions