Home › Forums › Backend Issues (wp-admin) › get_field() returns null after importing › Reply To: get_field() returns null after importing
I figured out what the problem was. Dug into the source quite a bit and found out that there is one field that is generated by the update post action that was missing. So, the correct way to import a field is using THREE meta fields
<wp:postmeta>
<wp:meta_key>field_53c9df3d9e257</wp:meta_key>
<wp:meta_value><![CDATA[a:2:{s:4:"name";s:11:"module_name";s:3:"key";s:11:"module_name";}]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>module_name</wp:meta_key>
<wp:meta_value><![CDATA[ node-jvm ]]></wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_module_name</wp:meta_key>
<wp:meta_value><![CDATA[ field_53c9df3d9e257 ]]></wp:meta_value>
</wp:postmeta>
For some reason ACF stores entire field definition with each post, I just used a couple of fields that seemed important and this worked for me.
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!
🚨 The 2023 ACF Annual Survey closes tomorrow! This is your last chance to complete the survey and help guide the evolution of ACF. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 18, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.