Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Call to undefined function bw_theme_field_date() #182

Closed
bobbingwide opened this issue Aug 16, 2021 · 1 comment
Closed

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Aug 16, 2021

When the [bw_table] shortcode refers to post_date or post_modified and oik-fields is not activated then bw_theme_field_date() is not defined.

This causes a Fatal error.

[16-Aug-2021 17:07:26 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function bw_theme_field_date() in C:\apache\htdocs\wordpress\wp-content\plugins\oik\libs\bw_fields.php:253
Stack trace:
#0 C:\apache\htdocs\wordpress\wp-content\plugins\oik\libs\bw_fields.php(221): bw_theme_field__date('post_date', '2021-10-05 21:2...', Array)
#1 C:\apache\htdocs\wordpress\wp-content\plugins\oik\libs\bw_fields.php(194): bw_theme_field__post_date('post_date', '2021-10-05 21:2...', Array)
#2 C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-table.php(123): bw_theme_field('post_date', '2021-10-05 21:2...', Array)
#3 C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-table.php(183): bw_format_table_row(Object(WP_Post), Array, NULL)
#4 C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-table.php(206): bw_format_table(Array, Array)
#5 C:\apache\htdocs\wordpress\wp-content\plugins\oik\libs\oik-shortcodes.php(229): bw_table(Array, '', 'bw_table')
#6 C:\apache\htdocs\cwiccer\wp-includes\shortcodes.php(356): bw_shortcode_event(Array, '', 'bw_table')
#7 [internal function]: do_shortcode_tag(Array)
#8 C:\apache\htdocs\cwiccer\wp-includes\shortcodes.php(228): preg_replace_callback('/\\[(\\[?)(bw_pag...', 'do_shortcode_ta...', '<!-- wp:paragra...')
#9 C:\apache\htdocs\wordpress\wp-content\plugins\oik\includes\bw_posts.php(172): do_shortcode('<!-- wp:paragra...')
#10 C:\apache\htdocs\wordpress\wp-content\plugins\oik\includes\bw_posts.php(227): bw_get_the_excerpt('<!-- wp:paragra...')
#11 C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-table.php(179): bw_excerpt(Object(WP_Post))
#12 C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-table.php(206): bw_format_table(Array, Array)
#13 C:\apache\htdocs\wordpress\wp-content\plugins\oik\libs\oik-shortcodes.php(229): bw_table(Array, '', 'bw_table')
#14 C:\apache\htdocs\wordpress\wp-content\plugins\oik\shortcodes\oik-content.php(71): bw_shortcode_event(Array, '', 'bw_table')
#15 C:\apache\htdocs\wordpress\wp-content\plugins\oik\oik.php(714): oik_content_block(Array)
#16 C:\apache\htdocs\cwiccer\wp-includes\class-wp-block.php(221): oik_dynamic_block_content_block(Array, '', Object(WP_Block))
#17 C:\apache\htdocs\cwiccer\wp-includes\blocks.php(864): WP_Block->render()
#18 C:\apache\htdocs\cwiccer\wp-includes\blocks.php(902): render_block(Array)
#19 C:\apache\htdocs\cwiccer\wp-includes\class-wp-hook.php(303): do_blocks('<!-- wp:paragra...')
#20 C:\apache\htdocs\cwiccer\wp-includes\plugin.php(189): WP_Hook->apply_filters('<!-- wp:paragra...', Array)
#21 C:\apache\htdocs\cwiccer\wp-includes\rest-api\endpoints\class-wp-rest-revisions-controller.php(603): apply_filters('the_content', '<!-- wp:paragra...')
#22 C:\apache\htdocs\cwiccer\wp-includes\rest-api\endpoints\class-wp-rest-autosaves-controller.php(406): WP_REST_Revisions_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
#23 C:\apache\htdocs\cwiccer\wp-includes\rest-api\endpoints\class-wp-rest-autosaves-controller.php(239): WP_REST_Autosaves_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request))
#24 C:\apache\htdocs\cwiccer\wp-includes\rest-api\class-wp-rest-server.php(1140): WP_REST_Autosaves_Controller->create_item(Object(WP_REST_Request))
#25 C:\apache\htdocs\cwiccer\wp-includes\rest-api\class-wp-rest-server.php(987): WP_REST_Server->respond_to_request(Object(WP_REST_Request), '/wp/v2/pages/(?...', Array, NULL)
#26 C:\apache\htdocs\cwiccer\wp-includes\rest-api\class-wp-rest-server.php(414): WP_REST_Server->dispatch(Object(WP_REST_Request))
#27 C:\apache\htdocs\cwiccer\wp-includes\rest-api.php(370): WP_REST_Server->serve_request('/wp/v2/pages/14...')
#28 C:\apache\htdocs\cwiccer\wp-includes\class-wp-hook.php(303): rest_api_loaded(Object(WP))
#29 C:\apache\htdocs\cwiccer\wp-includes\class-wp-hook.php(327): WP_Hook->apply_filters('', Array)
#30 C:\apache\htdocs\cwiccer\wp-includes\plugin.php(518): WP_Hook->do_action(Array)
#31 C:\apache\htdocs\cwiccer\wp-includes\class-wp.php(388): do_action_ref_array('parse_request', Array)
#32 C:\apache\htdocs\cwiccer\wp-includes\class-wp.php(750): WP->parse_request('')
#33 C:\apache\htdocs\cwiccer\wp-includes\functions.php(1291): WP->main('')
#34 C:\apache\htdocs\cwiccer\wp-blog-header.php(16): wp()
#35 C:\apache\htdocs\cwiccer\index.php(17): require('C:\\apache\\htdoc...')
#36 {main}
  thrown in C:\apache\htdocs\wordpress\wp-content\plugins\oik\libs\bw_fields.php on line 253
@bobbingwide
Copy link
Owner Author

bobbingwide commented Aug 16, 2021

The easiest solution is to check the function exists before calling it.

When oik-fields is activated the output could be something like this.
image

with the fix - calling _bw_theme_field_default() the dates are displayed but not formatted nicely.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant