Home › Forums › General Issues › Exporting/Importing – how to maintain the same id's
In short I’m trying to use WP Ultimate Importer Pro to export all the posts in my custom post type of Talent, along with all of the associated categories (which include custom taxonomy categories of ‘Location’, ‘Level’, and ‘Specialty’) from one website to another. I want to overwrite the current Talent and Taxonomy values in the 2nd site so that the ID’s of the taxonomy values remain the same. The issue is that it’s not maintaining the same ID for each value, but instead creating duplicate values with new ID values.
The custom post types are using ACF for most of the values including the taxonomy.
More of an explanation…. I have a family of 3 salon sites (custom wordpress theme) that are basically the same backend, just styled differently for each location. We have a custom post type of Talent for each stylist. Many of the ‘talent’ work at multiple locations so we want to maintain the same database of talent, and the same taxonomy, for all three locations. When I make a major update to the talent, I want to be able to export them from one site to the other 2 sites. The issue is when I import them it’s adding new duplicate taxonomy values rather than overwriting what’s there. This will not work because I built a custom filtering engine that uses the ID’s for the Location and Level values.
I have tried importing using both the “New Item” and “Existing Items” options, both with the same results. I have also tried deleting all the custom post (Talent) and all the Taxonomy values, before I import but then the ID’s are just continuing from the last one in the database, since those don’t really get deleted.
So Finally… My three main questions are:
Is there a setting inside WP Ultimate Importer Pro that will allow me to import in the posts and taxonomy values overwriting what’s there… and maintaining the same ID’s as the site exporting from?
Is there any easy way to delete all the DB values for the custom post type and the custom taxonomy values so that when I import them it will keep the same ID’s
Probably the best solution – is there a way to maintain one main database of Talent and taxonomy so that all three sites pull from the same database of talent?
Sorry for the long post but I thought it needed to be explained thoroughly. Thanks in advance for any help or suggestions.
I am not familiar with the settings for this plugin. I would think that an import plugin could do updates as well, but again, I do not know how the plugin works. The best place to get an answer to your questions would be to talk to the developer of the other plugin.
Thanks John, The main issue with the plugin is that it’s not overriding the existing values which is needed to maintain the same ID’s. None of the free plugins seem to handle this with Advanced custom fields unless you can figure out some difficult workarounds. I paid $150 for this plugin and their tech support was not too helpful on the issue. I was hoping for some way to do it with this plugin before paying for another which is likely to have the same issue. .
When I do imports I use WP All Import Pro (WPAI). This plugin has an add of for ACF. The updating feature. It can look for existing posts, terms, etc. They also have an export plugin. But it can take extra coding to use the export plugin.
The issue is that ACF stores ID values. This can be an issue with terms. Every import plugin that I know of works on the term name and not the term ID.
There are a couple of ways around this. For example using WPAI you can create a function on the import that can take the ID and convert it to an existing term name for the import plugin to use. But there is no capability in the plugin to actually update the term name of anything else related to the term.
You’re going to find that this is an issue with most import plugins. As far as I know there aren’t any import plugins that will do what you want to do without a bit of work. They all work with posts and do not do a great job with taxonomy terms unless you write code. I use WPAI because they provide a set of hooks that allow me to run custom code as well as run imported values through functions before they are imported.
Expanding on what I said. I would export and in the export I would have 2 columns. One that contains the term ID and a second that contains the term name. For the import I would import these to columns into custom fields in the post. WPAI has an action hook that runs after the post is imported. On this hook I would get the term ID value and the term name value and update the term myself.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.