简体   繁体   中英

Wordpress/Woocommerce shifting post ID's and order id's by 10000

I have a wordpress website running woocommerce. The website has pages created so the wp_posts and wp_postmeta table is populated with post ID's. I want to import orders from a different woocommerce site however if import those postids of course it will clash with my existing records in wp_posts for example as the ids will clash.

So I wanted to write a quick PHP script to shift all the current IDs in wp_posts to be say 10000 and onwards, that way i can import my data where the ids are all under 10000. So for example where I currently have a record in wp_posts with ID 4000, I would change the ID to be 10001. However the problem is i noticed i would also need to update wp_postmeta to change the mapping of the ID. Now its out of control because theres too much mention of the ids in other records such as meta_key in wp_postmeta

You don't need to write any custom script to do this. You can use plugins for this. Here's an example Order Export & Order Import for WooCommerce . You don't need to worry about the post id's, the plugin will take care of this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM