Home › Forums › ACF PRO › API returning erratic data from repeater fields, data not saving › Reply To: API returning erratic data from repeater fields, data not saving
Turns out it was this piece of code in functions.php that we were using to re-write the slugs on save of the posts was the issue:
function myplugin_update_slug( $data, $postarr ) {
if ( ! in_array( $data[‘post_status’], array( ‘draft’, ‘pending’, ‘auto-draft’ ) ) ) {
$data[‘post_name’] = sanitize_title( $data[‘post_title’] );
}
return $data;
}
The sanitize_title() function was overwriting the key field and causing ACF to lose track of the fields.
We resolved this by activating a clean WP theme, then once we confirmed that it was some code in our child theme we just commented out code in our functions.php file until the offending function was found.
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 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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.