Simon Pollard
Simon Pollard

Reputation: 2588

Customising ACF options page values on save

When saving the values on an ACF options page I need to hook into the save function to modify the values.

Looking at acf/save_post the values I get returned do not match up with the values in the options (I see it saves 4 fields in wp_options!). For example I get what appears to be a field name as value, post id is just 'options' and then the field array has no value fields at all.

Is there a correct way of handling the options save, so that I can update the correct fields with the correct values?

Upvotes: 0

Views: 1343

Answers (1)

justelouise
justelouise

Reputation: 770

The values saved in the options table actually include the key of each field so there are really records in there. That's just how ACF behaves. So you can just update the values through acf/save_post hook as you'd want to and ACF will save these updated values in the DB.

Upvotes: 1

Related Questions