Get field() (ACF)

Uit De Vliegende Brigade
Versie door Jeroen Strompf (overleg | bijdragen) op 1 aug 2022 om 09:16
(wijz) ← Oudere versie | Huidige versie (wijz) | Nieuwere versie → (wijz)
Naar navigatie springen Naar zoeken springen

get_field() is a PHP function of Advanced Custom Fields (ACF).


Returns the value of a specific field.

Intuitive and powerful (much like ACF itself ?), this function can be 
used to load the value of any field from any location. Please note 
that each field type returns different forms of data (string, int, 
array, etc).


get_field($selector, [$post_id], [$format_value]) as mixed
  • $selector (string, required): The field name or field key.
  • $post_id (mixed, optional): The post ID where the value is saved. Defaults to the current post.
  • $format_value (boolean, optional): Whether to apply formatting logic. Defaults to true.

Return: (mixed) The field value

See also