Skip Navigation

[Resolved] Site crashes after creating a View that didn’t work (the events calendar)

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

Problem:

PHP warning after updating The Events Calendar to version 6

Solution:

Follow the workaround below:

Relevant Documentation:

https://toolset.com/errata/php-warning-after-updating-the-events-calendar-to-version-6/

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.

This topic contains 8 replies, has 2 voices.

Last updated by kristenM 2 years ago.

Assisted by: Christopher Amirian.

Author
Posts
#2485663

I have been using Toolset on a new site and have build different post types and views.
Today I was ready to build a new View on the post type "Post" but when I tried it wouldn't show and afterwards I get this message when I try to edit a post or a page:

Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($function) must be a valid callback, class Tribe__Events__Query does not have a method "pre_get_posts" in /home/www/kroppedal.dk/wp-includes/class-wp-hook.php:307 Stack trace: #0 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #1 /home/www/kroppedal.dk/wp-includes/plugin.php(524): WP_Hook->do_action(Array) #2 /home/www/kroppedal.dk/wp-includes/class-wp-query.php(1818): do_action_ref_array('pre_get_posts', Array) #3 /home/www/kroppedal.dk/wp-includes/class-wp-query.php(3613): WP_Query->get_posts() #4 /home/www/kroppedal.dk/wp-includes/class-wp-query.php(3745): WP_Query->query(Array) #5 /home/www/kroppedal.dk/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/wp_query_factory.php(20): WP_Query->__construct(Array) #6 /home/www/kroppedal.dk/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group/factory.php(444): OTGS\Toolset\Common\WpQueryFactory->create(Array) #7 /home/www/kroppedal.dk/wp-content/plugins/types/vendor/toolset/toolset-common/inc/public_api/custom_fields.php(36): Toolset_Field_Group_Factory->query_groups(Array) #8 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/CustomFieldService.php(34): toolset_get_field_groups(Array) #9 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/DynamicSourceFactory.php(80): Toolset\DynamicSources\ToolsetSources\CustomFieldService->get_group_slugs_by_type('udstilling') #10 [internal function]: Toolset\DynamicSources\ToolsetSources\DynamicSourceFactory->Toolset\DynamicSources\ToolsetSources\{closure}(Array, 'udstilling') #11 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/DynamicSourceFactory.php(82): array_reduce(Array, Object(Closure), Array) #12 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/DynamicSourceFactory.php(35): Toolset\DynamicSources\ToolsetSources\DynamicSourceFactory->aggregate_group_slugs(Array) #13 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/Main.php(68): Toolset\DynamicSources\ToolsetSources\DynamicSourceFactory->get_sources(Array) #14 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\ToolsetSources\Main->Toolset\DynamicSources\ToolsetSources\{closure}(Array, Array) #15 /home/www/kroppedal.dk/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array) #16 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(455): apply_filters('toolset/dynamic...', Array, Array) #17 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(399): Toolset\DynamicSources\DynamicSources->register_data_sources(Array) #18 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->register_sources('') #19 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #20 /home/www/kroppedal.dk/wp-includes/plugin.php(476): WP_Hook->do_action(Array) #21 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(775): do_action('toolset/dynamic...') #22 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(744): Toolset\DynamicSources\DynamicSources->get_shortcode_content(Array) #23 /home/www/kroppedal.dk/wp-includes/shortcodes.php(356): Toolset\DynamicSources\DynamicSources->dynamic_shortcode_render(Array, '', 'tb-dynamic') #24 [internal function]: do_shortcode_tag(Array) #25 /home/www/kroppedal.dk/wp-includes/shortcodes.php(228): preg_replace_callback('/\\[(\\[?)(tb\\-dy...', 'do_shortcode_ta...', '[tb-dynamic pro...') #26 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(920): do_shortcode('[tb-dynamic pro...') #27 [internal function]: Toolset\DynamicSources\DynamicSources->Toolset\DynamicSources\{closure}(Array) #28 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(919): preg_replace_callback('#(\\[tb-dynamic\\...', Object(Closure), '<div class="tb-...') #29 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->shortcode_render('<div class="tb-...') #30 /home/www/kroppedal.dk/wp-includes/plugin.php(191): WP_Hook->apply_filters('<div class="tb-...', Array) #31 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv-shortcodes.php(2587): apply_filters('wpv-pre-do-shor...', '<div class="tb-...') #32 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv.class.php(2610): wpv_do_shortcode('<div class="tb-...') #33 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv.class.php(2141): WP_Views->render_view('502', '72b6adbade5da5d...') #34 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv.class.php(646): WP_Views->render_view_ex('502', '72b6adbade5da5d...') #35 /home/www/kroppedal.dk/wp-includes/shortcodes.php(356): WP_Views->short_tag_wpv_view(Array, '', 'wpv-view') #36 [internal function]: do_shortcode_tag(Array) #37 /home/www/kroppedal.dk/wp-includes/shortcodes.php(228): preg_replace_callback('/\\[(\\[?)(wpv\\-v...', 'do_shortcode_ta...', '\n<div class="wp...') #38 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): do_shortcode('\n<div class="wp...') #39 /home/www/kroppedal.dk/wp-includes/plugin.php(191): WP_Hook->apply_filters('\n<div class="wp...', Array) #40 /home/www/kroppedal.dk/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1811): apply_filters('the_content', '<!-- wp:uagb/co...') #41 /home/www/kroppedal.dk/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(560): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request)) #42 /home/www/kroppedal.dk/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->get_item(Object(WP_REST_Request)) #43 /home/www/kroppedal.dk/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages/(?...', Array, NULL) #44 /home/www/kroppedal.dk/wp-includes/rest-api.php(519): WP_REST_Server->dispatch(Object(WP_REST_Request)) #45 /home/www/kroppedal.dk/wp-includes/rest-api.php(2868): rest_do_request(Object(WP_REST_Request)) #46 [internal function]: rest_preload_api_request(Array, '/wp/v2/pages/23...') #47 /home/www/kroppedal.dk/wp-includes/block-editor.php(601): array_reduce(Array, 'rest_preload_ap...', Array) #48 /home/www/kroppedal.dk/wp-admin/edit-form-blocks.php(75): block_editor_rest_api_preload(Array, Object(WP_Block_Editor_Context)) #49 /home/www/kroppedal.dk/wp-admin/post.php(187): require('/home/www/kropp...') #50 {main} thrown in /home/www/kroppedal.dk/wp-includes/class-wp-hook.php on line 307

I have deactivated Toolset and Toolset Blocks and then the site works again.

Any suggestions?

Kind regards Kristen

#2485713

Hi again.
I have now tried to deactivate all other plugins and when I have deactivated
- The Events Calendar &
- Jeero import
I can create a new View.
When I activate The Events Calendar I can't use Views again.
I need to use The Events Calendar so what do I do?
Kind regards Kristen

#2486133

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

We have a known issue with The Events Calendar plugin.

Would you please follow the steps mentioned in the erratum below?

https://toolset.com/errata/paragraphs-and-line-breaks-missing-from-product-description-when-using-product-tabs-block/

Thank you.

#2486153

Hi Christopher.
Thank you for your reply. I have tried to follow this small erratum and put the snippet in to the themes functions.php.

I still get this message:

Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($function) must be a valid callback, class Tribe__Events__Query does not have a method "pre_get_posts" in /home/www/kroppedal.dk/wp-includes/class-wp-hook.php:307 Stack trace: #0 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #1 /home/www/kroppedal.dk/wp-includes/plugin.php(524): WP_Hook->do_action(Array) #2 /home/www/kroppedal.dk/wp-includes/class-wp-query.php(1818): do_action_ref_array('pre_get_posts', Array) #3 /home/www/kroppedal.dk/wp-includes/class-wp-query.php(3613): WP_Query->get_posts() #4 /home/www/kroppedal.dk/wp-includes/class-wp-query.php(3745): WP_Query->query(Array) #5 /home/www/kroppedal.dk/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/wp_query_factory.php(20): WP_Query->__construct(Array) #6 /home/www/kroppedal.dk/wp-content/plugins/types/vendor/toolset/toolset-common/inc/autoloaded/field/group/factory.php(444): OTGS\Toolset\Common\WpQueryFactory->create(Array) #7 /home/www/kroppedal.dk/wp-content/plugins/types/vendor/toolset/toolset-common/inc/public_api/custom_fields.php(36): Toolset_Field_Group_Factory->query_groups(Array) #8 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/CustomFieldService.php(34): toolset_get_field_groups(Array) #9 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/DynamicSourceFactory.php(80): Toolset\DynamicSources\ToolsetSources\CustomFieldService->get_group_slugs_by_type('udstilling') #10 [internal function]: Toolset\DynamicSources\ToolsetSources\DynamicSourceFactory->Toolset\DynamicSources\ToolsetSources\{closure}(Array, 'udstilling') #11 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/DynamicSourceFactory.php(82): array_reduce(Array, Object(Closure), Array) #12 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/DynamicSourceFactory.php(35): Toolset\DynamicSources\ToolsetSources\DynamicSourceFactory->aggregate_group_slugs(Array) #13 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/ToolsetSources/Main.php(68): Toolset\DynamicSources\ToolsetSources\DynamicSourceFactory->get_sources(Array) #14 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\ToolsetSources\Main->Toolset\DynamicSources\ToolsetSources\{closure}(Array, Array) #15 /home/www/kroppedal.dk/wp-includes/plugin.php(191): WP_Hook->apply_filters(Array, Array) #16 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(455): apply_filters('toolset/dynamic...', Array, Array) #17 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(399): Toolset\DynamicSources\DynamicSources->register_data_sources(Array) #18 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->register_sources('') #19 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) #20 /home/www/kroppedal.dk/wp-includes/plugin.php(476): WP_Hook->do_action(Array) #21 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(775): do_action('toolset/dynamic...') #22 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(744): Toolset\DynamicSources\DynamicSources->get_shortcode_content(Array) #23 /home/www/kroppedal.dk/wp-includes/shortcodes.php(356): Toolset\DynamicSources\DynamicSources->dynamic_shortcode_render(Array, '', 'tb-dynamic') #24 [internal function]: do_shortcode_tag(Array) #25 /home/www/kroppedal.dk/wp-includes/shortcodes.php(228): preg_replace_callback('/\\[(\\[?)(tb\\-dy...', 'do_shortcode_ta...', '[tb-dynamic pro...') #26 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(920): do_shortcode('[tb-dynamic pro...') #27 [internal function]: Toolset\DynamicSources\DynamicSources->Toolset\DynamicSources\{closure}(Array) #28 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/vendor/toolset/dynamic-sources/server/DynamicSources.php(919): preg_replace_callback('#(\\[tb-dynamic\\...', Object(Closure), '<div class="tb-...') #29 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): Toolset\DynamicSources\DynamicSources->shortcode_render('<div class="tb-...') #30 /home/www/kroppedal.dk/wp-includes/plugin.php(191): WP_Hook->apply_filters('<div class="tb-...', Array) #31 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv-shortcodes.php(2587): apply_filters('wpv-pre-do-shor...', '<div class="tb-...') #32 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv.class.php(2610): wpv_do_shortcode('<div class="tb-...') #33 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv.class.php(2141): WP_Views->render_view('502', '72b6adbade5da5d...') #34 /home/www/kroppedal.dk/wp-content/plugins/toolset-blocks/embedded/inc/wpv.class.php(646): WP_Views->render_view_ex('502', '72b6adbade5da5d...') #35 /home/www/kroppedal.dk/wp-includes/shortcodes.php(356): WP_Views->short_tag_wpv_view(Array, '', 'wpv-view') #36 [internal function]: do_shortcode_tag(Array) #37 /home/www/kroppedal.dk/wp-includes/shortcodes.php(228): preg_replace_callback('/\\[(\\[?)(wpv\\-v...', 'do_shortcode_ta...', '\n<div class="wp...') #38 /home/www/kroppedal.dk/wp-includes/class-wp-hook.php(307): do_shortcode('\n<div class="wp...') #39 /home/www/kroppedal.dk/wp-includes/plugin.php(191): WP_Hook->apply_filters('\n<div class="wp...', Array) #40 /home/www/kroppedal.dk/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1811): apply_filters('the_content', '<!-- wp:uagb/co...') #41 /home/www/kroppedal.dk/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(560): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request)) #42 /home/www/kroppedal.dk/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->get_item(Object(WP_REST_Request)) #43 /home/www/kroppedal.dk/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages/(?...', Array, NULL) #44 /home/www/kroppedal.dk/wp-includes/rest-api.php(519): WP_REST_Server->dispatch(Object(WP_REST_Request)) #45 /home/www/kroppedal.dk/wp-includes/rest-api.php(2868): rest_do_request(Object(WP_REST_Request)) #46 [internal function]: rest_preload_api_request(Array, '/wp/v2/pages/23...') #47 /home/www/kroppedal.dk/wp-includes/block-editor.php(601): array_reduce(Array, 'rest_preload_ap...', Array) #48 /home/www/kroppedal.dk/wp-admin/edit-form-blocks.php(75): block_editor_rest_api_preload(Array, Object(WP_Block_Editor_Context)) #49 /home/www/kroppedal.dk/wp-admin/post.php(187): require('/home/www/kropp...') #50 {main} thrown in /home/www/kroppedal.dk/wp-includes/class-wp-hook.php on line 307

#2486289

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Would you please contact your hosting service provider to provide you with the staging version of your website and share the login information in the next reply to follow up?

Please make sure that you set the next reply as private.

Thank you.

#2486723

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for the login info for the dev site. Yes by staging I meant a version that is not live and I can do tests.

I created a test page and set it as a draft. I added a View block and it had no issues there.

The only issue I see is that the text color for the button to add the view is white and the background is gray and it is hard to see. You can select the text to see that the text is there.

It might be related to the theme that you use or whatever plugin that causes the change in styling of the block editor.

But generally, I managed to add a view with no issues.

I see that you already added the proper code to the functions.php file.

hidden link

Thanks.

#2486937

Hi Christopher.
I think the reason you manage to create and edit a page is because I have deactivated "The Events Calendar".

I may not have been able to describe the problem properly so I try again 🙂

I have installed The EventsCalendar a week ago.
Saturday when I was trying to create a View it wouldn't work. It kind of stuck and I had to leave the page.
Afterwards when I tried to edit the frontpage I got the fatal error as described.
This error dissapeares when I deactivate The Events Calendar"
I didn't have the problem until the faulty creation of the View.

Now I have activated The Events Calendar again and I have the problem again. If yout try to edit the page you created it crashes. If you then try to open and edit another page without a view it works (try hidden link)
Kind regards Kristen

#2487525

Christopher Amirian
Supporter

Languages: English (English )

Ok thank you very much.

We have another errata that I will need you to check now:

https://toolset.com/errata/php-warning-after-updating-the-events-calendar-to-version-6/

In the errata there is a file which is the fixing version of the problem.

Would you please replace that file and see if it works?

Thanks.

#2487917

My issue is resolved now. Thank you!