Support

Account

Home Forums Backend Issues (wp-admin) ACF/SAVE_POST

Solved

ACF/SAVE_POST

  • In the example code:

    https://www.advancedcustomfields.com/resources/acfsave_post/

    Do you get the field data using your defined field name or the ACF field name?

    $field = $_POST['acf']['field_abc123'];

    That’s kind of ambiguous.

  • Before ACF, with a priority of <10 you must use $field = $_POST['acf']['field_abc123']; to get new values, the field name will not work. get_field(), with either the field name or the field key will return the old values.

    With a priorty >10 all methods of getting the values will return the new value.

  • Interesting…

    Here’s a question. If I call wp_insert_post() to create a new post and I use the ACF field names in the meta_input array, will that trigger ACF to do it’s thing?

  • What triggers ACF to save values is that $_POST[‘acf’] is set and has a value. I think that if you unset index before ACF (priority < 10) that ACF will do nothing at all, but I’m not 100% sure.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘ACF/SAVE_POST’ is closed to new replies.