Support

Account

Home Forums Backend Issues (wp-admin) Set WordPress excerpt and post thumbnail based on custom field Reply To: Set WordPress excerpt and post thumbnail based on custom field

  • ACF uses a Priority of 10 to do it’s own work on the acf/save_post hook.

    If you use a priority < 10 then your action will run before ACF. The values in the database will be the previous values and using get_field() at this point will return then previous values and not the new values that need to be saved.

    If you use a priority > 10 then your action will run after ACF has saved the new values to the DB. Using get get_field() here will return the newly saved values.

    The $_POST value that you should be looking at depends on what version of ACF you are using.

    In ACF5 it is $_POST['acf']

    In ACF4 you need to look at $_POST['fields']

    The nested index of the array for each field is the field key. For example $_POST['acf']['field_1234567890123]or$_POST[‘fields’][‘field_1234567890123] These values are the same no matter what priority you use for your action.