Custom Fields
Re-Envisioned
Support MB Views PHP error - trim(): Argument #1 ($string)

  • Creator
    Topic
  • #31221
    Prabakaran Shankar
    Participant

    Hello,
    I have an error log on my website. Please look at it.

    [08-Oct-2021 01:07:18 UTC] PHP Fatal error: Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /var/web/site/public_html/wp-includes/formatting.php:445

    PHP Stacktrace:
    /var/web/site/public_html/wp-includes/formatting.php(445): trim(Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer/MetaBox.php(110): wpautop(Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer/MetaBox.php(28): MBViews\Renderer\MetaBox->parse_field_value(Array, Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer/Post.php(26): MBViews\Renderer\MetaBox->get_data(Object(RW_Meta_Box), 'post', 590)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer/Post.php(15): MBViews\Renderer\Post->get_fields()
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer/Base.php(19): MBViews\Renderer\Post->get_data()
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/Extension/CoreExtension.php(1540): MBViews\Renderer\Base->__get('thumbnail')
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/Environment.php(358) : eval()'d code(79): twig_get_attribute(Object(MetaBox\Dependencies\Twig\Environment), Object(MetaBox\Dependencies\Twig\Source), Object(MBViews\Renderer\Post), 'thumbnail', Array, 'any', false, false, false, 41)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/Template.php(394): __TwigTemplate_8e5c09db1be1e756048d62af03050f9bbf00b73b228887a4d8c7ffaa83653b56->doDisplay(Array, Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/Template.php(367): MetaBox\Dependencies\Twig\Template->displayWithErrorHandling(Array, Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/Template.php(379): MetaBox\Dependencies\Twig\Template->display(Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/TemplateWrapper.php(40): MetaBox\Dependencies\Twig\Template->render(Array, Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/dependencies/Twig/Environment.php(277): MetaBox\Dependencies\Twig\TemplateWrapper->render(Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Renderer.php(50): MetaBox\Dependencies\Twig\Environment->render('schema-job-post...', Array)
    /var/web/site/public_html/wp-content/plugins/meta-box-aio/vendor/meta-box/mb-views/src/Shortcode.php(28): MBViews\Renderer->render(Object(WP_Post), Array)
    /var/web/site/public_html/wp-includes/shortcodes.php(356): MBViews\Shortcode->render(Array, '', 'mbv')
    /var/web/site/public_html/wp-includes/shortcodes.php(228): preg_replace_callback('/\[(\[?)(mbv)(?...', 'do_shortcode_ta...', '[mbv name="sche...')
    /var/web/site/public_html/wp-content/plugins/gp-premium/elements/class-hooks.php(210): do_shortcode('[mbv name="sche...')
    /var/web/site/public_html/wp-includes/class-wp-hook.php(303): GeneratePress_Hook->execute_hook('')
    /var/web/site/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array)
    /var/web/site/public_html/wp-includes/plugin.php(470): WP_Hook->do_action(Array)
    /var/web/site/public_html/wp-includes/general-template.php(3015): do_action('wp_head')
    /var/web/site/public_html/wp-content/themes/generatepress/header.php(17): wp_head()
    /var/web/site/public_html/wp-includes/template.php(770): require_once('/var/web/site/p...')
    /var/web/site/public_html/wp-includes/template.php(716): load_template('/var/web/site/p...', true, Array)
    /var/web/site/public_html/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
    /var/web/site/public_html/wp-content/themes/generatepress/single.php(12): get_header()
    /var/web/site/public_html/wp-includes/template-loader.php(106): include('/var/web/site/p...')
    /var/web/site/public_html/wp-blog-header.php(19): require_once('/var/web/site/p...')
    /var/web/site/public_html/index.php(17): require('/var/web/site/p...')
    {main} thrown in /var/web/site/public_html/wp-includes/formatting.php on line 445

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #31234
    Long Nguyen
    Moderator

    Hi,

    That means the argument pass to the function trim() is not a string, maybe an array. Can you please share some screenshots of the View code and the custom fields that you pass its value to the function trim()?

    Please read more on the documentation https://www.php.net/manual/en/function.trim.php

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.