Support Forum
We have a site in development that uses frontend forms. After updating to ver. 5.7.2 I am now getting the error that I will paste at the end of this message. If I rollback to 5.7.1, it all works again. Thanks for your help!
Here's the error:
Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /home/mywp/serve.mywp.dev/wp-admin/includes/template.php:1481 Stack trace: #0 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/fields/taxonomy.php(310): remove_meta_box('groupdiv', NULL, 'side') #1 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/fields/taxonomy.php(301): RWMB_Taxonomy_Field::remove_default_meta_box(Array) #2 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/field.php(535): RWMB_Taxonomy_Field::admin_enqueue_scripts(Array) #3 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/meta-box.php(134): RWMB_Field::call(Array, 'admin_enqueue_s...') #4 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Form.php(84): RW_Meta_Box->enqueue() #5 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Shortcode.php(35): MBFS\Form->render() #6 /home/mywp/serve.mywp.dev/wp-includes/shortcodes.php(355): MBFS\Shortcode->shortcode(Array, '', 'mb_frontend_for...') #7 [internal function]: do_shortcode_tag(Array) #8 /home/mywp/serve.mywp.dev/wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(mb_fro...', 'do_shortcode_ta...', '<div class="fl-...') #9 /home/mywp/serve.mywp.dev/wp-content/plugins/bb-plugin/classes/class-fl-builder.php(1999): do_shortcode('<div class="fl-...') #10 /home/mywp/serve.mywp.dev/wp-content/plugins/bb-plugin/classes/class-fl-builder.php(2055): FLBuilder::render_content_by_id(1668) #11 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(308): FLBuilder::render_content('\n\n\t<p>You can u...') #12 /home/mywp/serve.mywp.dev/wp-includes/plugin.php(205): WP_Hook->apply_filters('\n\n\t<p>You can u...', Array) #13 /home/mywp/serve.mywp.dev/wp-includes/post-template.php(255): apply_filters('the_content', '<!-- wp:fl-buil...') #14 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/template-parts/content/entry_content.php(27): the_content('Continue readin...') #15 /home/mywp/serve.mywp.dev/wp-includes/template.php(785): require('/home/mywp/serv...') #16 /home/mywp/serve.mywp.dev/wp-includes/template.php(718): load_template('/home/mywp/serv...', false, Array) #17 /home/mywp/serve.mywp.dev/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #18 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/template-parts/content/single-entry.php(28): get_template_part('template-parts/...', 'page') #19 /home/mywp/serve.mywp.dev/wp-includes/template.php(785): require('/home/mywp/serv...') #20 /home/mywp/serve.mywp.dev/wp-includes/template.php(718): load_template('/home/mywp/serv...', false, Array) #21 /home/mywp/serve.mywp.dev/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #22 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/inc/template-functions/single-functions.php(27): get_template_part('template-parts/...', 'page') #23 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(308): Kadence\single_content('') #24 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #25 /home/mywp/serve.mywp.dev/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #26 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/template-parts/content/single.php(34): do_action('kadence_single_...') #27 /home/mywp/serve.mywp.dev/wp-includes/template.php(785): require('/home/mywp/serv...') #28 /home/mywp/serve.mywp.dev/wp-includes/template.php(718): load_template('/home/mywp/serv...', false, Array) #29 /home/mywp/serve.mywp.dev/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #30 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/inc/template-functions/single-functions.php(20): get_template_part('template-parts/...', 'page') #31 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(308): Kadence\single_markup('') #32 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #33 /home/mywp/serve.mywp.dev/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #34 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/page.php(20): do_action('kadence_single') #35 /home/mywp/serve.mywp.dev/wp-includes/template-loader.php(106): include('/home/mywp/serv...') #36 /home/mywp/serve.mywp.dev/wp-blog-header.php(19): require_once('/home/mywp/serv...') #37 /home/mywp/serve.mywp.dev/index.php(17): require('/home/mywp/serv...') #38 {main} thrown in /home/mywp/serve.mywp.dev/wp-admin/includes/template.php on line 1481
'Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /home/mywp/serve.mywp.dev/wp-admin/includes/template.php:1481 Stack trace: #0 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/fields/taxonomy.php(310): remove_meta_box('groupdiv', NULL, 'side') #1 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/fields/taxonomy.php(301): RWMB_Taxonomy_Field::remove_default_meta_box(Array) #2 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/field.php(535): RWMB_Taxonomy_Field::admin_enqueue_scripts(Array) #3 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box/inc/meta-box.php(134): RWMB_Field::call(Array, 'admin_enqueue_s...') #4 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Form.php(84): RW_Meta_Box->enqueue() #5 /home/mywp/serve.mywp.dev/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-frontend-submission/src/Shortcode.php(35): MBFS\Form->render() #6 /home/mywp/serve.mywp.dev/wp-includes/shortcodes.php(355): MBFS\Shortcode->shortcode(Array, '', 'mb_frontend_for...') #7 [internal function]: do_shortcode_tag(Array) #8 /home/mywp/serve.mywp.dev/wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(mb_fro...', 'do_shortcode_ta...', '<div class="fl-...') #9 /home/mywp/serve.mywp.dev/wp-content/plugins/bb-plugin/classes/class-fl-builder.php(1999): do_shortcode('<div class="fl-...') #10 /home/mywp/serve.mywp.dev/wp-content/plugins/bb-plugin/classes/class-fl-builder.php(2055): FLBuilder::render_content_by_id(1668) #11 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(308): FLBuilder::render_content('\n\n\t<p>You can u...') #12 /home/mywp/serve.mywp.dev/wp-includes/plugin.php(205): WP_Hook->apply_filters('\n\n\t<p>You can u...', Array) #13 /home/mywp/serve.mywp.dev/wp-includes/post-template.php(255): apply_filters('the_content', '<!-- wp:fl-buil...') #14 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/template-parts/content/entry_content.php(27): the_content('Continue readin...') #15 /home/mywp/serve.mywp.dev/wp-includes/template.php(785): require('/home/mywp/serv...') #16 /home/mywp/serve.mywp.dev/wp-includes/template.php(718): load_template('/home/mywp/serv...', false, Array) #17 /home/mywp/serve.mywp.dev/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #18 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/template-parts/content/single-entry.php(28): get_template_part('template-parts/...', 'page') #19 /home/mywp/serve.mywp.dev/wp-includes/template.php(785): require('/home/mywp/serv...') #20 /home/mywp/serve.mywp.dev/wp-includes/template.php(718): load_template('/home/mywp/serv...', false, Array) #21 /home/mywp/serve.mywp.dev/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #22 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/inc/template-functions/single-functions.php(27): get_template_part('template-parts/...', 'page') #23 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(308): Kadence\single_content('') #24 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #25 /home/mywp/serve.mywp.dev/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #26 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/template-parts/content/single.php(34): do_action('kadence_single_...') #27 /home/mywp/serve.mywp.dev/wp-includes/template.php(785): require('/home/mywp/serv...') #28 /home/mywp/serve.mywp.dev/wp-includes/template.php(718): load_template('/home/mywp/serv...', false, Array) #29 /home/mywp/serve.mywp.dev/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #30 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/inc/template-functions/single-functions.php(20): get_template_part('template-parts/...', 'page') #31 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(308): Kadence\single_markup('') #32 /home/mywp/serve.mywp.dev/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #33 /home/mywp/serve.mywp.dev/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #34 /home/mywp/serve.mywp.dev/wp-content/themes/kadence/page.php(20): do_action('kadence_single') #35 /home/mywp/serve.mywp.dev/wp-includes/template-loader.php(106): include('/home/mywp/serv...') #36 /home/mywp/serve.mywp.dev/wp-blog-header.php(19): require_once('/home/mywp/serv...') #37 /home/mywp/serve.mywp.dev/index.php(17): require('/home/mywp/serv...') #38 {main} thrown in /home/mywp/serve.mywp.dev/wp-admin/includes/template.php on line 1481
'
Hello Chris,
Can you please let me know how to reproduce the issue? You can also try to deactivate all plugins except Meta Box, MB extensions and switch to a standard theme of WordPress then check this issue again.
Here's a screencast showing the error: https://d.pr/i/VJXuyk
With ONLY Meta Box and Meta Box AIO enabled on the Twenty Twenty Three theme I still get the fatal error.
If I have only Meta Box enabled (and not AIO), I don't get the error.
Sorry for the separate replies. This will be my last one until I hear from you again I think. If I disable the extension "Meta Box Builder" in the AIO plugin, the error goes away (of course so do my custom fields). I'm happy to provide admin access if that would help.
SOLVED but there is something not right.
Here's a video that explains what we figured out:
https://d.pr/v/7w1buO
Here's the code I reference in the video:
<?php $terms = rwmb_meta( 'taxonomy_groups' ); ?>
<h3>Project categories</h3>
<ul>
<?php foreach ( $terms as $term ) : ?>
<li><a href="<?= get_term_link( $term ) ?>"><?= $term->name ?></a></li>
<?php endforeach ?>
</ul>
<?php // or simpler: ?>
<h3>Project categories</h3>
<?php rwmb_the_value( 'taxonomy_groups' ); ?>
Hello,
I can see the issue on my demo site. Following the documentation, you should use the option "Remove default meta box" with the Classic Editor
https://docs.metabox.io/fields/taxonomy/
https://wordpress.org/plugins/classic-editor/
When editing the taxonomy in Meta Box > Taxonomies, you can disable option "Show on edit page" in the Advanced tab, to remove the default taxonomy box of WordPress.
Interesting. Hopefully, these things in MB will be moved forward to support block and site editor. That's the future of WordPress even if we don't feel ready for that. Oddly, this setting worked even with the block editor until the latest version of MB.
Have a good weekend. You can close this.
I too got an error as soon as I upgraded to the latest version and luckily was able to revert with Updraft Plus. This is the error that get's generated in the WordPress log:
[24-Jun-2023 13:14:31 UTC] PHP Fatal error: Uncaught eLightUp\Twig\Error\SyntaxError: Unexpected character "#" in "jarvis-news-before-article-content" at line 30. in /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Lexer.php:363
Stack trace:
#0 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Lexer.php(290): eLightUp\Twig\Lexer->lexExpression()
#1 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Lexer.php(184): eLightUp\Twig\Lexer->lexVar()
#2 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(469): eLightUp\Twig\Lexer->tokenize()
#3 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(516): eLightUp\Twig\Environment->tokenize()
#4 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(348): eLightUp\Twig\Environment->compileSource()
#5 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(309): eLightUp\Twig\Environment->loadTemplate()
#6 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Environment.php(277): eLightUp\Twig\Environment->load()
#7 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer.php(72): eLightUp\Twig\Environment->render()
#8 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/ActionLoader.php(55): MBViews\Renderer->render()
#9 /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/ActionLoader.php(46): MBViews\ActionLoader->render_view()
#10 /sites/ajtatumdigital.com/html/wp-includes/class-wp-hook.php(308): MBViews\ActionLoader->MBViews\{closure}()
#11 /sites/ajtatumdigital.com/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#12 /sites/ajtatumdigital.com/html/wp-includes/plugin.php(517): WP_Hook->do_action()
#13 /sites/ajtatumdigital.com/html/wp-content/themes/kadence/template-parts/content/entry_header.php(29): do_action()
#14 /sites/ajtatumdigital.com/html/wp-includes/template.php(785): require('...')
#15 /sites/ajtatumdigital.com/html/wp-includes/template.php(718): load_template()
#16 /sites/ajtatumdigital.com/html/wp-includes/general-template.php(204): locate_template()
#17 /sites/ajtatumdigital.com/html/wp-content/themes/kadence/template-parts/content/single-entry.php(22): get_template_part()
#18 /sites/ajtatumdigital.com/html/wp-includes/template.php(785): require('...')
#19 /sites/ajtatumdigital.com/html/wp-includes/template.php(718): load_template()
#20 /sites/ajtatumdigital.com/html/wp-includes/general-template.php(204): locate_template()
#21 /sites/ajtatumdigital.com/html/wp-content/themes/kadence/inc/template-functions/single-functions.php(27): get_template_part()
#22 /sites/ajtatumdigital.com/html/wp-includes/class-wp-hook.php(308): Kadence\single_content()
#23 /sites/ajtatumdigital.com/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#24 /sites/ajtatumdigital.com/html/wp-includes/plugin.php(517): WP_Hook->do_action()
#25 /sites/ajtatumdigital.com/html/wp-content/themes/kadence/template-parts/content/single.php(34): do_action()
#26 /sites/ajtatumdigital.com/html/wp-includes/template.php(785): require('...')
#27 /sites/ajtatumdigital.com/html/wp-includes/template.php(718): load_template()
#28 /sites/ajtatumdigital.com/html/wp-includes/general-template.php(204): locate_template()
#29 /sites/ajtatumdigital.com/html/wp-content/themes/kadence/inc/template-functions/single-functions.php(20): get_template_part()
#30 /sites/ajtatumdigital.com/html/wp-includes/class-wp-hook.php(308): Kadence\single_markup()
#31 /sites/ajtatumdigital.com/html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#32 /sites/ajtatumdigital.com/html/wp-includes/plugin.php(517): WP_Hook->do_action()
#33 /sites/ajtatumdigital.com/html/wp-content/themes/kadence/single.php(20): do_action()
#34 /sites/ajtatumdigital.com/html/wp-includes/template-loader.php(106): include('...')
#35 /sites/ajtatumdigital.com/html/wp-blog-header.php(19): require_once('...')
#36 /sites/ajtatumdigital.com/html/index.php(18): require('...')
#37 {main}
thrown in /sites/ajtatumdigital.com/html/wp-content/plugins/meta-box-aio/vendor/elightup/twig/Twig/Lexer.php on line 363
The same error is thrown for the view "novashare-before-content".
For "jarvis-news-before-article-content"
I have the following:
{% set post_category = mb.get_the_terms(post.ID, 'article_category')|first %}
{% set post_source = mb.get_the_terms(post.ID, 'article_source')|first %}
<div class="entry-taxonomies">
<span class="category-links term-links category-style-pill">
<a href="https://ajtatumdigital.com/articles/category/{{ post_category.slug }}/" rel="category tag" title="{{ post_category.name }}" itemprop="articleSection">
<span class="jarvis-news-fa-dark-icon">
<i class="fa-duotone fa-tags fa-lg"></i>
</span>
{{ post_category.name }}
</a>
</span>
<span class="category-links term-links category-style-pill">
<a href="https://ajtatumdigital.com/articles/source/{{ post_source.slug }}/" rel="category tag" title="{{ post_source.name }}" itemprop="creditText">
<span class="jarvis-news-fa-dark-icon">
<i class="fa-duotone fa-browsers fa-lg"></i>
</span>
{{ post_source.name }}
</a>
</span>
</div>
<aside class="ajtd-novashare">
{{ mb.do_shortcode('[novashare_inline_content]') }}
</aside>
And for "novashare-before-content" I have:
</div>
{% set post_contains_affiliate_links = post.contains_affiliate_links %}
{% if post_contains_affiliate_links == 1 %}
<aside id="disclaimer-text">
<p class="has-text-align-center"><strong>Affiliate Disclaimer:</strong> This site contains affiliate links. If you make a purchase through our site, we may earn a commission at no extra cost to you. <strong><a title="Disclaimer" href="https://ajtatumdigital.com/legal/disclaimer/" target="_blank" rel="noopener">Learn more.</a></strong></p>
</aside>
{% endif %}
<aside class="ajtd-novashare">
{{ mb.do_shortcode('[novashare_inline_content]') }}
</aside>
Everything works fine with version 5.7.2, but as soon as I upgrade to 5.7.3, pretty much all of Metabox Views throw errors.
Oh, and for further information, those views have a type "Action" and hook into one of my themes action hooks.
@AJ Tatum: perhaps you're having the same problem I have: https://support.metabox.io/topic/fatal-single-quote-error-in-meta-box-5-7-3-and-aio-1-21-2/
Indeed it does. It seems that this version wasn't very well tested before being released. I simply reverted the upgrade as it would take me a long time to try and fix all the MB Views...
@AJ Tatum: We reverted also. I see that they have released 5.7.3. Have you tried that yet? I'm hoping it will fix this issues. But the weekend isn't the best time for me to find out. 🙂
I haven't tried it and not planning to at the moment as I don't have time right now to handle any "what if" scenarios LOL.