Search results for ""

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

Inline edit checkbox column set meta to 0 when unchecked


I am using Admin Columns Pro with Toolset Types, I have created a simple checkbox custom field and in Toolset Types I have configured it to store ‘1’ if the field is checked, and when unchecked save 0 to the database. In the All Posts admin screen I have ACP setup to show the toolset field with inline editing, if I check the field then ‘1’ is saved to the database for the custom checkbox field, however I then uncheck the field all data for the field is removed from the database instead of saving a ‘0’ to the database. This is breaking some of the filters I have setup in Toolset Views as it’s looking for a ‘0’.

Are you able to fix this please?


1 year, 8 months ago

I just want to add then when I edit the post directly and check and save then uncheck and save it is correctly placing a ‘0’ into the database, the problem is only with inline editing in ACP.

1 year, 8 months ago

Thanks for your feedback.
I was able to reproduce this issue with the Types setting.
We’ll make sure it will be changed in the next release of the Types integration.
In the meantime, you could use the following snippet to correct it for your environment.

add_filter( 'acp/editing/save_value', function ( $value, AC\Column $column ) {
	if ( $column instanceof ACA\Types\Column && $column->get_field() instanceof ACA\Types\Field\Checkbox ) {
		if ( ! $value && $column->get_field()->get( 'save_empty' ) === 'yes' ) {
			$value = '0';

	return $value;
}, 10, 2 );

It uses the following hook.


1 year, 8 months ago

Thank you so much Stefan! That fixed it for me, my custom filers are now working correctly every time. I really appreciate your help with fixing this.

1 year, 8 months ago

You must be logged in to reply to this topic.