Update sub field() (ACF)

Uit De Vliegende Brigade
Versie door Jeroen Strompf (overleg | bijdragen) op 29 jul 2022 om 16:26 (→‎Syntaxis)
(wijz) ← Oudere versie | Huidige versie (wijz) | Nieuwere versie → (wijz)
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.

Syntaxis

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.

Bronnen