Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load an ACF field's options dynamically via PHP. For more info see https://philkurth.com.au/tips/load-an-acf-field's-options-dynamically-via-php/
<?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
You can’t perform that action at this time.