Support

Account

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.