Update sub field() (ACF): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
Regel 6: Regel 6:
  
 
<pre>
 
<pre>
update_sub_field($selector, $value, [$post_id]); as boolean
+
update_sub_field($selector, $value, [$post_id]) as boolean
 
</pre>
 
</pre>
  

Versie van 29 jul 2022 14:21

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.