Plugin Conflict with WooCommerce

#503489
  • Resolved Tara Gardner
    Rank Math free

    Only seeing these warnings on my WooCommerce /shop page.

    I completed the Troubleshooting and with only RankMath and WooCommerce enabled the warnings appear. Because it is a shop page WooCommerce must be activated to test. This is an Elementor Theme and site, however it doesn’t seem to be the problem.

    Warning: Attempt to read property “post_content” on null in … /wp-content/plugins/seo-by-rank-math/includes/opengraph/class-image.php on line 510

    Warning: Attempt to read property “ID” on null in … /wp-content/plugins/seo-by-rank-math/includes/opengraph/class-image.php on line 510

    Warning: Attempt to read property “post_content” on null in … /wp-content/plugins/seo-by-rank-math/includes/opengraph/class-image.php on line 510

    Warning: Attempt to read property “ID” on null in … /wp-content/plugins/seo-by-rank-math/includes/opengraph/class-image.php on line 510

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    Looking forward to helping you.

    Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    I logged into your site and went through a few troubleshooting steps, and was able to find the root cause of this issue.

    Your shop page is built on the Elementor template and even if it is being identified as a shop page, it doesn’t contain a post ID, which is why Rank Math was unable to go through with the intended procedure and was trying to set an image to OpenGraph image from the post content.

    However, I’ve added the following filter to your site, the issue is fixed now and I left the Rank Math plugin activated on your site.

    /**
     * Passing a truthy value to the filter will effectively short-circuit the
     * set content image process.
     *
     * @param bool $return  Short-circuit return value. Either false or true.
     */
    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.
    	}
    });

    I’ve added the filter in your active theme’s functions.php for now, but please be advised that, the filter will be overwritten once you update your theme. Hence, I suggest you to follow the guide I’ve shared below to learn the stable and permanent ways to add filters/hooks to your site:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    If you don’t want to keep this filter, another way could be to resolve this issue is to create a page from your WordPress Dashboard and apply the Elementor template on that page, so that the page contains an ID alongside represents itself as a shop page, as Rank Math doesn’t add image from the post content for shop pages that contains post ID.

    Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.

    Thank you.

    Hello and thank you. Creating a page (my preferred method) didn’t work. WooCommerce and Elementor are very specific it seems and the inserted template doesn’t display on the new page.

    I commented out your snippet in functions.php and added the rank-math.php file to the theme with the code snippet. Everything works. Question though. Will a Theme upgrade override (delete and not re-create) the rank-math.php file also? Seems like it might. Should I instead create a child theme?

    Hello,

    Yes, you should use child theme to not lose any changes after you update your theme.

    You can either use the Code Snippets plugin or use a child theme to keep the filters active without worrying of losing them.

    Hope that clarifies your doubt.

    Thank you.

    Thank you I have added the snippet and the Shop works fine. Thank you. Ticket closed. I appreciate your help!

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘Plugin Conflict with WooCommerce’ is closed to new replies.