Hi,
I have an field group with a taxonomy field. This field has Appearance set to “Select”. Now in the resulting select2 field, I would like to change the placeholder. The only reference to the placeholder that I can find is in the javascript api so I have tried the following:
acf.add_filter('select2_args', function( args, $select, settings ){
if ( 'event_name' == settings.field.data.name ) {
args.placeholder = 'Search for event';
}
// return
return args;
});
Unfortunately the placeholder is still the default “Select”. Is there another way to set the placeholder for this field? Maybe on the server side?
The solution ended up being very simple. Just update the data in the $select variable instead of the placeholder in args. This is done by replacing the line
args.placeholder = 'Search for event';
with
$select.data( 'placeholder', 'Search for event' );