Home Forums Front-end Issues Field values not showing up (front-end) after XML import


Field values not showing up (front-end) after XML import

  • I’ve just exported an XML and imported it to another WP install (3.7.1).

    All the field names and values are in the wp_postmeta database, and I can also see the values on the admin side.

    However, if I use get_field on the front-end, nothing shows up… If I save the corresponding post, the value does show up.

    I have over 700 posts so I’m not planning on manually saving them one by one. Maybe I can do this with the save_post action, but I’m not sure how (think I can figure it out though).

    Just wondering if I did something wrong, or if I can do something about this other than writing a function that loops through all posts and saves them.

    Thanks in advance.

  • Hi @joostvanhoof

    Just to clarify, this was a WP export data, and then a WP import data?

    Can you check that all the custom field values exist in the database and that for each value, there is a hidden value with the same field name but with an underscore before it.

    This ‘reference’ value is explained here and is important for ACF to format the value before returning it:


  • Hi Elliot,

    Yes this was WP export data and then WP import data (xml).

    All the custom field values exist in the database and for each value there’s a hidden value with the same field name with an underscore before it.

    But because you pointed this out, I’ve just compared values of the reference field (by turning on ‘key’ in the screen options) and they don’t match. I don’t know why, I guess the import and/or export screwed up.

    Should everything work if I update the values of the reference fields? We’re talking 700+ custom posts, so then I’d make a loop which goes through all the posts and then use update_post_meta($post_id, '_f_city', 'field_correct_value');.


  • Hi @joostvanhoof

    Yes, that would work perfectly. I’ll do some expot tests and find out why the field key is changed.


  • Hi @joostvanhoof

    Did you create the field’s manually on the live site (the site you imported the xml file into)?

    This would explain why the origional site and the live site contain different field keys

  • Hi Elliot,

    Yes I did… That’s not so smart of me, but luckily we’ve got it figured out now.

    One question though so I fully understand; in the database both value and reference fields are there: eg f_city and _f_city. So why can’t get_field('f_city') find the value?

    Does that mean that there’s another table with information on the reference field? I don’t really understand why information is in the DB, also viewable on the admin side but not queryable on the front-end.

    Thanks for you time,

  • Hi @joostvanhoof

    The get_field function will be able to load the value, however it will not be able to format it.

    This means, if your f_city field is a text field, you will be fine. However, if this field is an image, you will not be able to format the value and get the image data as expected.

    Does this help?

  • Hi Elliot,

    I just found out more. Both the values of the key and reference fields are correct in the database. But because I’ve manually created the fields, the values of the reference field in the acf_ post type didn’t correspond. I was thinking the values didn’t match because I was looking at the ‘key’ value in the admin side of ACF instead of directly in the database.

    I’ve tried editing the values of the reference field directly in the database, but that breaks the group admin side stuff of ACF. So I’ve tried exporting the field groups, editing the reference values in the XML and then importing. It worked for some fields, but others have now disappeared.

    It seems that my sloppy import/export actions and manually creating the fields have messed things up and this conversation did bring up the actual problem at hand so I’ll mark it as solved.

    I can let you know if I fixed everything for if you like to write something on migration in the future or if other people encounter the same problems.

    Thanks again!

  • Hey all, our team recently did an import/export of fields. We took fields from v 3.5 to v 4.3.9. All fields came over with data intact except for the image fields. Posts are missing corresponding images, aka, the image fields are blank in the editor. We took all the above advice and combed our database for reference keys, everything matched. The fields we migrated were done purely with export/import, and not added manually. We did have an issue migrating the Uploads folder from the previous site, and had to add the images into the media library using this plugin: Add from Server. Would this mess up the corresponding image IDs? Also, the image field isn’t necessarily blank, there’s a small grey rectangle in place of where the image thumbnail should be, when clicked to edit, we get an edit screen that’s broken, we’re unable to type in it and it’s missing the image thumb. Any thoughts? Thank you.

  • I am also having the same problem. I can see all my fields populated on the back end when editting a Post but they won’t show up in Preview or even after being Published. I imported the fields from another site (of a business partner) using the WordPress import XML format. I’m not sure how to go about getting the fields to show up, can someone please point me in the right direction?

    I am using the Point Theme
    Wordpress Version 4.0

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

The topic ‘Field values not showing up (front-end) after XML import’ is closed to new replies.