Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Load an ACF field's options dynamically via PHP. For more info see's-options-dynamically-via-php/
add_filter( 'acf/load_field/name=countries', function ( $field ) {
$field['choices'] = [
'au' => 'Australia',
'nz' => 'New Zealand',
'gb' => 'United Kingdom',
'us' => 'United States',
// …
return $field;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment