Home Forums General Issues WP All Import + Page Link field


WP All Import + Page Link field

  • I’m currently migrating data from one WordPress installation to another using WP All Import. Although the process is a bit complicated, once you get the hang of it, it works very smoothly.

    I’m having issues with importing data from Page Link fields though. I can’t seem to make it work. My proccess is:

    1. Export data from posts as CSV
    2. Find and replace the absolute URL to the new one
    3. Import

    ACF won’t recognize the new field, even though the imported URL is correct.

    I have also asked for help on WP All Import’s support service. It might be an issue with the plugin, might be an issue with how my data is formated.

    Has anybody else had this problem?

  • Ok, so I realized Page Link fields return an absolute URL, but actually store a reference to the associated post ID. I’ll see if I can find a way to export the associated post ID instead of the URL.

  • I was able to fix the issue. The solution is a bit iffy, so if anybody can provide a better solution I’d be more than happy to hear it.

    The problem is that ACF outputs an absolute path to the page/post/etc. when using a Page Link field, but WP All Import requires either a post ID or slug to make it work. I have no idea why they wouldn’t accept an absolute path, but they don’t.

    Running a simple find and replace on the exported CSV file to keep only the ending, hence the slug, worked. Even though I had to keep the last /, WPAI remade the connexion.

    The iffy part is in the admin. I don’t directl see the reference to the page/post, but the absolute path. No idea why, but it works.

  • So, this might be a dumb question. If you are just migrating data from one WP installation to another, and all the data needs to remain the same, is there any reason you don’t eiter:

    1) export then entire database and import all the data into the new database. This would be my choice.

    2) Use the standard WP export/import tool plugin

  • I ran into a situation where I needed to move only part of the installation. I usually transfert the whole database, but in this situation it was not ideal.

    The standard WP export/import tool does not support multilingual websites built with WPML, so I couldn’t use it.

  • The main problem is that the ACF field in both installations is going to store a page ID, most of the time for this field. Whatever is in the field in one site needs to be in that field in the other site. When using WP all import there isn’t any way to know what the new post ID for imported posts is going to be. There are many fields in ACF that only store ID values. image fields, gallery fields, relationship fields, user fields, page link fields. These fields need to be exported using the value in the DB and imported using the same value. All the ID values that they point to must be the same on both sites, so if there is an image on one site, or a page link, or any of the others, that object must have the same ID on the new site. Either this of someone is going to need to do a whole lot of manual editing once the import is completed to fix all of this.

    From your explanation of what you did, I think that it’s the best you’re going to get in this case.

  • Indeed, the information needs to be the same. In this specific case, the posts would have had the same IDs, so if I would have been able to just grab the post ID from the start, it would have been easy. I’m not going to detail the whole process I had to go through. It wasn’t pretty, and there definetely would have been a better way for the whole thing to go down. Sometimes, that’s just how it is.

    What I find strange though is that ACF stores an ID number for Page Link fields, but outputs an absolute URL. And that WP All Import grabs the retuned value. It might be using ACF functions (get_field()) to return the value instead of grabbing it directly in the database?

  • Are you using WPAI to export the values? I’ve used the import, but not the export.

  • Yes, everything is exported using WPAI. WPAE actually (WP All Exporter), which is a sister-plugin to WPAI. WPAE exports a Page Link field absolute path, and WPAI requires an ID or slug. I’ve flagged the issue to the plugin creator, hopefuly they’ll fix it!

  • That was going to be my suggestion, it should be exporting a value that can be used for importing. But it makes a lot more sense now. When exporting something like an image field, they’d want that to be an absolute URL because WPAI will retrieve the image from that URL and insert it into the media library and then put the ID into the ACF field.

    The page link field is an odd field. It stores the post ID when the link is to a post, but unlike other ACF field it can contain values that are not IDs when linking to an archive page or a taxonomy/term page. That may be part of the issue with the exported values. It is the only ACF field that I know of that can contain multiple types of values in the database.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘WP All Import + Page Link field’ is closed to new replies.