Update sub field() (ACF)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

update_sub_field(): Updates the value of a specific sub field.

This function can be used inside or outside of a have_rows() loop. When used inside, the current row will be used to update the sub field value. When used outside, the rows and parents must be specified to target the correct value place.


update_sub_field($selector, $value, [$post_id]) as boolean
  • $selector (required, string|array): The sub field name or key, or an array of ancestors and row numbers.
  • $value (required, mixed): The new value.
  • $post_id (optional, mixed): The post ID where the value is saved. Defaults to the current post.