[wp-hackers] wordpress import. does it really work?

Brian Layman wp-hackers at thecodecave.com
Mon Apr 9 19:21:32 UTC 2012


On 4/9/2012 12:42 AM, Haluk Karamete wrote:
> then run
>
> TRUNCATE TABLE wp_links
> TRUNCATE TABLE wp_posts
> TRUNCATE TABLE wp_terms
> TRUNCATE TABLE wp_term_taxonomy
> TRUNCATE TABLE wp_term_relationships
>
> this literally clears the mentioned 5 tables.

Since this has been touched upon several times recently, I want to 
mention that truncating a table does not restore it back to its original 
state.

The auto increment field in each of the tables is still going to be at 
the next number to be generated.  If you want to empty and reset 
WordPress's tables, try something like this..

truncate table wp_terms;
truncate table wp_term_taxonomy;
truncate table wp_term_relationships;
truncate table wp_commentmeta;
truncate table wp_comments;
truncate table wp_links;
truncate table wp_options;
truncate table wp_postmeta;
truncate table wp_posts;
truncate table wp_users;
truncate table wp_usermeta;
alter table wp_terms auto_increment = 1;
alter table wp_term_taxonomy auto_increment = 1;
alter table wp_commentmeta auto_increment = 1;
alter table wp_comments auto_increment = 1;
alter table wp_links auto_increment = 1;
alter table wp_options auto_increment = 1;
alter table wp_postmeta auto_increment = 1;
alter table wp_posts auto_increment = 1;
alter table wp_users auto_increment = 1;
alter table wp_usermeta auto_increment = 1;

Alter to fit your needs.  And yes wp_term_relationships doesn't have an 
auto_increment field. It's not a copy/paste mistake.

Brian Layman


More information about the wp-hackers mailing list