Skip Navigation

[Resolved] Fatal error when displaying imported checkbox field

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

Problem: I have imported a site using FG Drupal to WordPress. Now when I try to display a custom field using a Types field shortcode, I see a fatal error:

Fatal error: Uncaught Error: Call to a member function get_value_filtered() on null in /path/to/site/wp-content/plugins/types/application/models/field/type/checkbox/view/frontend.php:33

Solution: Resave the field group containing this custom field, clear the Views cache, clear the Kinsta cache.

This support ticket is created 3 years, 11 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)

This topic contains 7 replies, has 2 voices.

Last updated by Christian Cox 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1919533

I have a custom post type "Funder", which has a Checkbox field "highlightfund". When I try to display this using a content template, I'm getting a fatal error:
Fatal error: Uncaught Error: Call to a member function get_value_filtered() on null in /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/models/field/type/checkbox/view/frontend.php:33 Stack trace: #0 /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/models/field/view.php(42): Types_Field_Type_Checkbox_View_Frontend->get_value() #1 /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/models/field/service.php(145): Types_Field_View->render() #2 /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/functions_public.php(58): Types_Field_Service->render_frontend(Object(Types_Field_Gateway_Wordpress_Post), Object(WP_Post), 'highlightfund', Array, '') #3 /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/functions_public.php(34): types_render_postmeta('highlightfund', Array, '') #4 /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/models/shortcode in /www/voluntarysectorgatewaywestlo_847/public/wp-content/plugins/types/application/models/field/type/checkbox/view/frontend.php on line 33

Content template has a single line:
Highlight Fund? [types field='highlightfund'][/types]

Here's the front end page showing the broken output: hidden link

Could you take a look please and see what's going on?

Thanks,

Chris

#1919663

Hi, I'll be glad to take a closer look. I just ran a quick test on my local environment to see if I could reproduce a similar error when displaying a checkbox field value using a Types shortcode in a Content Template with Toolset Blocks, but I didn't see any errors like this. Can you try these troubleshooting steps first?
- Perhaps there was a problem during a Types update, and the plugin was not installed successfully. To test this, you can reinstall the latest version of Types by downloading the plugin from https://toolset.com/account/downloads. Then in your site's wp-admin area, go to Plugins > Installed Plugins and deactivate and delete the current version of Types. Go to Plugins > Add New and upload the new version of Types you downloaded from the site here.
- The same could be the problem for Toolset Blocks, so I would try downloading the latest version from https://toolset.com/account/downloads, then deactivate and delete the old version in wp-admin and reinstall the newest plugin.
- If manually reinstalling Types and Blocks does not resolve the fatal error, please try activating a default theme like Twenty Twenty One, and deactivate all plugins except Toolset Types and Toolset Blocks. If the problem is resolved, reactivate your theme and other plugins one by one until the problem returns.

Please include your site's debug information in your next reply as explained in our FAQ here: https://toolset.com/faq/provide-debug-information-faster-support/

Let me know the results of these tests, provide your debug information, and we can go from there. Thank you!

#1920293

Hi Christian,

Thanks for getting back to me.

I've tried reinstalling Types and Blocks as you suggest, and switching to Twenty Twenty One theme, deactivating all other plugins, but unfortunately it's still giving the same error.

Debug info provided as requested.

If you could take a further look I'd appreciate that. As this is an early stage development site, it's no problem to give you access if that's helpful.

Thanks,

Chris

#1920461

Okay thanks for the basic troubleshooting. Please provide login credentials in the private reply fields here and I will be glad to take a closer look. If I don't see anything obviously wrong, I may need to create a clone of this site using the Duplicator plugin to run additional tests locally.

#1920619

Not sure what was happening here. I was trying a few things in wp-admin and I think I've solved the problem...somehow? I cleared the Views cache in Toolset > Settings > Frontend Content, I resaved the Funder Field Groups here: https://vsgwl.formandfunction.dev/wp-admin/admin.php?page=wpcf-edit&group_id=897 and cleared the Kinsta cache. Now I'm not seeing the error anymore. Very odd, but it does seem to be working now. Can you take a look and confirm or provide more details?
hidden link
hidden link
hidden link
hidden link

#1920677

Brilliant! Yes, that seems to be working for me now as well.

It's very puzzling why it was happening. The only thing that's unusual with this site is that the data for the CPTs was imported from a Drupal site. We did this using a plugin called FG Drupal to WordPress Premium (hidden link), which uses Types to create the custom post types and custom fields. So the fields weren't created directly in Types but by this plugin - I wonder if there was some error in the structure of the field data, which was resolved when you resaved the field group?

Anyhow, that's fixed for me now. Thanks very much for your help.

Best wishes,

Chris

#1920679

My issue is resolved now. Thank you!

#1920687

Ah okay yes, I assume there was some problem during the conversion process. Resaving the field group set the proper structures in place. I haven't seen this specific problem before but glad to know it's working better now. Feel free to reach out if other problems pop up.