• Resolved exetico

    (@exetico)


    Hi,

    With Rank Math version 1.0.206, I’m facing the following PHP error on my page, set as my WooCommerce Shop page:

    Warning: Array to string conversion in /var/www/domain.com/public_html/wp-content/plugins/seo-by-rank-math/includes/opengraph/class-image.php on line 606

    WooCommerce Shop Page

    Please fix it ??

    Thank you.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @exetico,

    Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.

    Could you please confirm if you’re using a template or Elementor template for your shop page?

    If so, then you can try to add the following filter on your website and see if that works for you:

    add_filter( 'rank_math/opengraph/pre_set_content_image', function( $return ) { if(is_shop()){ return true; // Set to true if you don't want to set image from Content. } });

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Let us know how it goes.

    Thread Starter exetico

    (@exetico)

    Hi Rank Math Support

    It’s only present on the WooCommerce page marked as the “Shop” page. It’s not a problem on every other shop query page, product page, and more.

    I’m using Oxygen (Builder), but if I disable the pre_set_content_image, wouldn’t that impact all pages? I don’t have any problems on normal product pages.

    Thread Starter exetico

    (@exetico)

    I’ve now added it, but the error are still there (tested with both Code Snippets, and inside my own plugin – I’ve also tested with different priority).

    • This reply was modified 1 year ago by exetico.
    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @exetico,

    This being the shop page archive, the filter shared previously won’t work because there’s another condition outside the one where the filter runs in the code which triggers the function to set the archive image.

    One way to get around this would be to set a default image for Facebook under WordPress Dashboard > Rank Math SEO > Titles & Meta > Products.

    This way the plugin would be able to set this to the archive page and not throw the warning.

    In any case, please note that those are just warnings and as long as you don’t have the WordPress debugging outputting to the pages, which you shouldn’t it won’t cause any issues on the website.

    Don’t hesitate to get in touch if you have any other questions.

    Thread Starter exetico

    (@exetico)

    Thanks for the reply.

    There’s clearly a “array to string conversion” going on, which I’d expect the Rank Math team to note down, and fix at some time. At least add some checks, to prevent the error from being a thing, in the first place :-). But, that’s not the case, or?

    WP_DEBUG are already set to false.

    I’ve also set a default image for Facebook now, and the same error still shows.

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @exetico,

    This is just a warning and it only happens in specific cases where the settings saved in the database don’t contain the particular archive image.

    This could also happen if you are creating an archive page with an unsupported method and the plugin is not able to associate the ID of the page with the archive set in the WooCommerce settings.

    If you have already disabled the WordPress debugging the warning should no longer be shown on the page, so if you still see it, make sure to clear the browser caching.

    Thank you.

    Thread Starter exetico

    (@exetico)

    If I set @ini_set( 'display_errors', 0 ); it goes away, all other normal WP_CONFIGs like “WP_DEBUG”, “WP_DEBUG_DISPLAY” and “SCRIPT_DEBUG” does not prevent it from being rendred.

    Could you please fix the logics in the plugin code-base?
    I know it’s “just a error render” but, that kind of errors shouldn’t be a thing in the first place, as it should be handled properly in the code-base?

    I can see it’s mentioned before, by seaching after the same topic on Google, so there’s more than one good reason to fix it.

    Please look into patching this? It’s a bit odd that it has not been handled by the devs at this point :-)?

    Thanks.

    • This reply was modified 10 months, 3 weeks ago by exetico.
    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @exetico,

    We have asked the devs to take a closer look at this and they would like to check this further on your site. If you can allow that, please open a topic in our support forum to get in touch with our development team. https://rankmath.com/support/

    Looking forward to helping you.

    Same issue here. I see it also that this should be handled in the core not by us users. And I may understand it incorrectly but I do not find or like the offered solution to add a genereic image for all facebook shares. For instance the product shares should show the individual product image

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @mike8040,

    Thank you so much for your input. Our developers are looking into this to eliminate these types of warnings. If this is something to be added in a future update. We will announce it here:?https://rankmath.com/changelog/

    Do let us know if you need help with anything else.

    I have the same error on Version 1.0.222, At the page “courses” when using Tutor LMS.
    I’ve added an image but same error. I had to add @ini_set( ‘display_errors’, 0 );

    Please review the plugin and fix the error…it shouldn’t have this error ??

    Plugin Support Rank Math Support

    (@rankmathsupport)

    Hello @mihaiiceyro,

    We released a quick Beta update you can try to see if that helps.

    Please enable the Beta update by following this:
    https://rankmath.com/kb/version-control/#beta-updates

    Screenshot for reference: https://i.rankmath.com/i/KVQuSM

    If you are unable to see an update, please clear Rank Math’s transients from:
    WP Dashboard > Rank Math > Status & Tools > Database Tools > Remove Rank Math Transients > Remove transients

    Screenshot for reference: https://i.rankmath.com/i/6NWTO8

    Please clear the caches, server, and WordPress after updating.

    You can disable the Beta updates once you update to the latest version and if the issue is fixed.

    We are here to assist. Thank you.

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