Support

Account

Home Forums General Issues get_field() returns false until post is resaved, but i have 1000+ posts! Reply To: get_field() returns false until post is resaved, but i have 1000+ posts!

  • Only if you submit all of the ACF data. When you click on update an array is submitted, it looks something like this

    
    $_POST['acf'] = array(
      // field key value pair for a simple text field
      'field_12345' => 'text value here',
      // field key value pair for a repeater fields
      'field_23456' => array(
        // each row of the repeater is a nested array
        array(
          // each sub field key value pair
          'field_34567' => 'some value',
          'field_45678' => 'another value'
        )
      ),
    );
    

    If you constructed the above array in $_POST for all of your fields and trigger update_post, ACF would do the work. Building this array would not be an easy process.

    It all goes back to the data not being migrated properly. I’m not sure how you got the data from one site to the other, but there are ways to do this that do not create this issue.

    One example is wP All Import Pro with the ACF add on. http://www.wpallimport.com/. This solution can be used where the field keys on one site do not match the field keys on the second site it this is part of the issues.

    When I migrate a site I export the DB using phpMyAdmin and then import it into a new site with the same tool.

    There are also various site migration tools available.