Skip Navigation

[Resolved] Single Checkbox not saving

This thread is resolved. Here is a description of the problem and solution.

Problem: A single checkbox custom field value is not being saved correctly in wp-admin.

Solution: Run the relationship migration wizard or update to the latest version of Types.

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 12 replies, has 2 voices.

Last updated by Christian Cox 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#910746

Types version 2.3 and newer is not letting me save the checked state of a custom field checkbox. When I reverted to v 2.2.23 it started working again.

#910752

Hi, can you tell me a bit more about what is happening?
- Are any errors displayed on the screen?
- Are any errors logged in the browser console?
- Can you test with all other plugins deactivated and a default theme like Twenty Seventeen active?
- Please take a screenshot of this field in the Custom Field editor screen so I can see the configurations for this checkbox.

#910829
Screen Shot 2018-06-07 at 2.55.14 PM.png

No errors displayed on the screen or in the browser console. I have tested the issue on both the production site and my local install. I also just tested it on my local install with the TwentySixteen theme and all other plugins deactivated.

Oddly, the issue doesn't appear to happen on a child site on the same network (it's a multisite install). It also isn't happening on a totally different site I manage on another server.

I can post admin credentials if you want to take a look.

#910834

Yes please, provide login credentials here and let me know which post you are editing when you experience the problem.

#910850

I've seen similar problems when MaxInputVars is set too low to handle all the necessary data in wp-admin. This could also account for why it's not happening on other sites in the same network - the posts may not have as many custom fields. Is it possible to bump your server's MaxInputVars up to 5000? You may have to connect with your host to have this implemented.

#911129

I just bumped the max_input_vars from 3000 to 5000 on my local install with no affect. The page I'm editing only has about 20 custom fields anyway, so I wouldn't think that would be a problem. Any other suggestions?

#911530

Check this draft post:
hidden link

I am able to save the checkbox field without any problems on this post when I save as draft...can you confirm? If so, then I would start by comparing this post with other posts, both in wp-admin and in the database. Look for anything suspicious. If posts were migrated from another site, you could double check the post IDs to make sure there's nothing suspicious going on there.

Another suggestion: turn on server logs to see if any errors, warnings or notices are being recorded during testing.

#911872

You may have noticed I have a intermediary post type linking models to communities at the bottom. I have discovered that when there is a "Model to Community Link" attached to the model, the single checkbox fields do not save. When I remove that intermediary post, they start working again. I also have a "Quick Move In" post type that is a child of Models; when I add one of those it also removes the single checkbox values.

What do you suggest I do?

#911987

Okay thanks, I've had some discussion with the team and it turns out this issue has been reported in a couple of other tickets, but not recognized as a bug yet. Now we understand that it indeed has to do with intermediary post types. We have noticed that the issue goes away if you run the post relationship migration process by going to Toolset > Relationships. Otherwise, the problem occurs. If your site is ready to migrate to new post relationships, this problem may be resolved automatically. Please create a full backup of your site files and database before migration.

If your site is not ready to migrate, then you can wait for a patch or plugin update, or manually set custom field values in the database.

#912075

Yes, I'd call that a bug. 🙂

I ran the migration on my local site, and it appeared to work, but it raises another question.

On this site in question, we have custom post types Models, Communities, and Model-Community-Links. There is a many-to-many relationship between models and communities. The "model-community-link" CPT connects them, and those links have some custom meta fields associated with them.

When I ran the migration on my local site, Toolset appears to have created 2 different link CPTs with one-to-many relationships: "models_model-community-link" and "communities_model-community-link". Is this the expected behavior?

#912427

Okay yes, this is expected at the moment. Unfortunately it means right now it's not possible to take advantage of the new M2M features for posts in these relationships. We are working on an update to Types that will allow you to merge these old relationship intermediaries into a single, updated M2M relationship. You can follow along with this other ticket that describes how the patch will work in more detail, and you can sign up there to receive a beta version of that release before the final version is released: https://toolset.com/forums/topic/migrating-from-old-many-to-many-to-new-one/#post-906094

#915283

Just a quick note to inform you that the next release of Types will include a permanent solution to this problem. I'll update the ticket here when the release is available.

#922254

Just an update to let you know the latest version of Types includes a fix for the problem with intermediary post types and checkboxes. If you already migrated to the new post relationships system, no additional changes are necessary. Please find the latest version of Types available for download or automatic update.