• Resolved ritikkothari

    (@ritikkothari)


    I am using the WPGraphQL plugin (Version 1.11.1) to transfer some data in my application. When I activate the plugin, my application crashes. It shows the following error.

    Fatal error: Uncaught TypeError: Argument 4 passed to WPGraphQL\Utils\Preview::filter_post_meta_for_previews() must be of the type bool or null, array given, called in /var/www/html/wp-includes/class-wp-hook.php on line 309 and defined in /var/www/html/wp-content/plugins/wp-graphql/src/Utils/Preview.php:23 Stack trace: #0 /var/www/html/wp-includes/class-wp-hook.php(309): WPGraphQL\Utils\Preview::filter_post_meta_for_previews(NULL, 38, 'gm_custom_prese...', Array) #1 /var/www/html/wp-includes/plugin.php(191): WP_Hook->apply_filters(NULL, Array) #2 /var/www/html/wp-includes/meta.php(632): apply_filters('get_post_metada...', NULL, 38, 'gm_custom_prese...', Array, 'post') #3 /var/www/html/wp-includes/meta.php(571): get_metadata_raw('post', 38, 'gm_custom_prese...', Array) #4 /var/www/html/wp-includes/post.php(2485): get_metadata('post', 38, 'gm_custom_prese...', Array) #5 /var/www/html/wp-content/themes/stratusx/base.php(20): get_post_meta(38, 'gm_custom_prese...', Array) #6 /var/www/html/wp-includes/template-loader.php(106): in /var/www/html/wp-content/plugins/wp-graphql/src/Utils/Preview.php on line 23

    I am unable to fix it. I want to know what is the issue. Need some help.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Jason Bahl

    (@jasonbahl)

    @ritikkothari Hey!

    I’m sorry you’re having this issue.

    In order to help, we’ll need more information so we can reproduce.

    Can you share what version of WordPress and PHP you’re on, and also what other plugins/themes (and versions) you have active?

    The more information we have, the better we can reproduce and help fix.

    Based on the error you pasted, there might be a conflict with your theme: /var/www/html/wp-content/themes/stratusx/base.php

    Thread Starter ritikkothari

    (@ritikkothari)

    @jasonbahl I am using PHP 7.4 and WordPress 6.0.2.

    Some of the plugins that I am using:
    Better search replace – v1.4
    Big file uploads – v2.1.1
    Elementor – v2.5.4
    Elementor header and footer – v1.6.9
    Formidable forms – v5.1
    HT Mega – Absolute Addons for Elementor Page Builder – v1.7.3
    Kirki Customizer Framework – v3.1.9
    Metaslider – v3.27.8
    Option Tree – v2.7.3
    PrimeSlider – v2.10.0
    Really Simple SSL – v5.3.1
    Simple page ordering – v2.3.4
    Smart slider 3 – v3.5.1.7
    Widget login – v5.10.4
    WP Basic authentication – v1.0.1

    I have installed the stratus theme but I haven’t activated it. Are you sure that the theme might be the issue?

    Plugin Author Jason Bahl

    (@jasonbahl)

    @ritikkothari I’m not 100% sure, but I see it in the error log you pasted, so the code seems to be executing and causing some sort of conflict.

    Plugin Author Jason Bahl

    (@jasonbahl)

    @ritikkothari if possible, could you activate the TwentyTwenty theme and see if the error goes away? If not, can you de-activate plugins one by one and note when the error goes away?

    Plugin Author Jason Bahl

    (@jasonbahl)

    ^ I’d recommend doing this on a staging or local environment if possible.

    Thread Starter ritikkothari

    (@ritikkothari)

    Sure @jasonbahl . Will try that and update you

    Plugin Author Jason Bahl

    (@jasonbahl)

    This line in your error log looks suspect: get_metadata_raw('post', 38, 'gm_custom_prese...'

    Do you know where in your codebase that is called?

    Plugin Author Jason Bahl

    (@jasonbahl)

    The docs for that function show the 4th argument should be a boolean (true or false): https://developer.www.ads-software.com/reference/functions/get_metadata_raw/

    However your logs make it appear like the 4th argument passed to that function is an array, not a boolean.

    Thread Starter ritikkothari

    (@ritikkothari)

    @jasonbahl When I enabled the TwentyTwenty theme, the problem disappeared. It is a problem with the stratus theme. I’m still interested in using that theme in my application. Is there an escape route?

    Plugin Author Jason Bahl

    (@jasonbahl)

    @ritikkothari Yes, if you look at the error log that you pasted, it shows the error.

    As mentioned above, it appears that the theme is calling get_metadata_raw in a way that’s not officially supported by the function.

    I provided a link to the docs for that function.

    The 4th argument should be a boolean value, but the theme passes an array.

    Plugin Author Jason Bahl

    (@jasonbahl)

    Marking this resolved as we’ve identified the code in the theme that is calling a function improperly.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Activating the WPGraphQL plugin crashes my wordpress site.’ is closed to new replies.