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!
We’re working hard on Advanced Custom Fields PRO 6.0, and Beta 1 is now available 🚀
— Advanced Custom Fields (@wp_acf) August 12, 2022
Featuring improved performance for Repeater fields with large datasets, and a new generation of ACF Blocks.
Let’s take a look 🧵https://t.co/Befre3kFAo
© 2022 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.