0

After changing the name of a ACF field, existing fields for some posts are not updating, but some are. Also, new posts are recorded correctly and can be updated. It's just that some of the old ones are updating and some are not.

Using the FF Inspector the headers are showing the correct key/values being sent, but the return is the old data. I scoured the wp_posts and wp_postmeta tables and all the field names correspond perfectly and there are no dupes or similarly-named fields.

wp_postmeta:

+---------+---------+----------------+---------------------+
| meta_id | post_id | meta_key       | meta_value          |
+---------+---------+----------------+---------------------+
THIS ONE IS NOT SAVING...
|    9112 |    2010 | _credentials   | field_5b870fbb8566d |
|    9114 |    2010 | _last_name     | field_5b914a1a17588 |
|    9116 |    2010 | _portrait      | field_5b870ff68566f |
|    9118 |    2010 | _not_accepting | field_5c40ff846cbb0 |
THIS ONE IS SAVING...
|   10313 |    2212 | _credentials   | field_5b870fbb8566d |
|   10315 |    2212 | _last_name     | field_5b914a1a17588 |
|   10317 |    2212 | _portrait      | field_5b870ff68566f |
|   10319 |    2212 | _not_accepting | field_5c40ff846cbb0 |
+---------+---------+----------------+---------------------+

wp_posts:

+---------------+---------------+---------------------+
| post_title    | post_excerpt  | post_name           |
+---------------+---------------+---------------------+
| Credentials   | credentials   | field_5b870fbb8566d |
| Last Name     | last_name     | field_5b914a1a17588 |
| Portrait      | portrait      | field_5b870ff68566f |
| Not accepting | not_accepting | field_5c40ff846cbb0 |
+---------------+---------------+---------------------+

In reading the ACF docs, tried adding this to functions.php to see what values are making that far, but I must be missing something important because it's not echoing anything:

function my_acf_save_post( $post_id ) {

    // array of field values
    $fields = $_POST['acf'];
    echo var_dump ($fields);
}
add_action('acf/save_post', 'my_acf_save_post', 1);

Trying adding a new ACF field to the group: anything saving before is still aving, but one not updating before are still not.

Questions: 1. Any ideas off the bat? Anything I should be looking for or knowing about all this? 2. What is the proper way to check to make sure values are getting to wherever they are supposed to be saved? 3. Should I be updating them manually? (least desired)

Brad

  • Regarding the last part, I don't think you'd want to echo a var dump, just let var dump itself echo out. I haven't had a lot of good luck with updating field names in ACF and not losing some data. But I'm just commenting for the bit about var dump – tmdesigned Feb 10 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.