Skip Navigation

[Resolved] Ticking ‘When unchecked, save 0 to the database’ isn’t working

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 0 replies, has 1 voice.

Last updated by Alex W 5 hours, 52 minutes ago.

Assisted by: Minesh.

Author
Posts
#2795597

I have added a custom checkbox field that I need to get the value of '0' from when it's unchecked. It's not doing this. I saved the post, and output the value of the checkbox via a View and it's showing nothing at all. When I do tick the box and do the same, it is showing '1'. Any idea why it's not saving '0'? Is this a known bug?

#2795658

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean you want to list the posts where the checkbox field is not chekced? if yes:

Can you please share problem URL where you added your view as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2795705

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When you import the content that does not mean that it will save 0 to imported posts.

But I've workaround for that.

I've added the new code snippet "Remove Hide from comingsoon posts from view" and added the following code to it:
=> hidden link

function func_remove_hide_from_comingsoon_posts( $query_args ,$view_settings, $view_id ) {
    global $post;
    global $current_user; 
    if ( $view_id == 1322290 ) {
       
       
		$query_args['meta_query'][] = array(
                                    'key'     => 'wpcf-hide-from-coming-soon',
                                     'compare' => 'NOT EXISTS');      
    }
    return $query_args;
}
add_filter( 'wpv_filter_query', 'func_remove_hide_from_comingsoon_posts', 10, 3);

Can you please confirm it works as expected now:
=> hidden link

More info:
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#2795711

Thank you Minesh, that is working really well.