Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Siro L

Cannot select null for ACF fields

I’m not able to select null for ACF fields in bulk or inline editing. Some of my fields require null to deselect all choices. See the attached images of a button group.

Button group selected
Button group null

Same problem with a text field when I try to clear a price number to null. If I leave it blanks it prompts a message “please fill out this field.” I had to use a space to clear everything. Is there a way to resolve this issue?

S.

3 years, 5 months ago
heyJoeCampbell

I too would like to know how to change an ACF to null – I am open to using a function to resolve the matter.

3 years, 2 months ago
Stefan van den Dungen Gronovius
Developer

Depending on the field you’re trying to edit, you can change the edit settings with this hook:

https://github.com/codepress/admin-columns-hooks/blob/master/acp-editing-view_settings.php

You’ll have to check for your column and set $data['clear_button'] = true.
This is an example snippet.

add_filter( 'acp/editing/view_settings', function( $data, AC\Column $column ){
	if( $column instanceof ACA\ACF\Column && $column->get_meta_key() === 'your_key' ){
		$data['required'] = false;
		$data['clear_button'] = true;
	}
	return $data;
}, 10, 2 );
3 years, 2 months ago

You must be logged in to reply to this topic.