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.
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 most recent ACF Chat Friday featured a live demo of how to register CPTs directly in the plugin, one of our most requested features. Check out the summary below for a replay of the demo, and don’t forget to register for the next session! https://t.co/k2KQ3WWBAz
— Advanced Custom Fields (@wp_acf) March 9, 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.