• Resolved Jose

    (@giuse)


    Hello

    I’m the author of Freesoul Deactivate Plugins https://wordpress.org/plugins/freesoul-deactivate-plugins/

    FDP lets you disable plugins on specific pages.
    The website of a user is triggering a fatal error because he has disabled WooCommerce on a specific page, and RankMath has some code that depends on WooCommerce.

    The fatal error is triggered in wp-content/plugins/seo-by-rank-math/includes/class-post.php on line 176 because the function is_cart doesn’t exist if WooCommercee is disabled.

    Probably you are checking if WooCommerce is active looking at the output of the option ‘active_plugins’. The output of that option can be filtered by other plugins, in this case, Freesoul Deactivate Plugins. So I suggest checking if WooCommerce is active by checking the existence of its classes or functions and don’t trust the output of ‘active_plugins’.
    In this case according to the option ‘active_plugins’ WooCommerce is active, because FDP doesn’t change that option, but on the page where the fatal error is triggered, the filter applied on ‘active_plugins’ before WooCommerce is loaded return s an array of plugins without WooCommerce, then after all plugins are loaded FDP removes all its filters.

    If in your code you check if WooCommerce is active looking on the option ‘active_plugins’ after all plugins are loaded, you will think WooCommerce is active because at that point FDP has already removed all its filters. If it didn’t remove them, it would create problems when other plugins save the option active_plugins, because that option would be saved with the wrong set of plugins.

    Let me know if you need more information from my side.

    I think the problem can be easily solved wrapping your code in something that looks like:

    if( function_exists( ‘is_cart’ ) ){
    //your code
    }

    or whatever ensures that WooCommerce is active.

Viewing 5 replies - 1 through 5 (of 5 total)
  • +1

    Plugin Author Rank Math

    (@rankmath)

    Hello @giuse & @michaelm89 ,

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

    We have fixed the issue internally and in the upcoming update it should be fixed.

    We will notify here as soon as the update is released.

    We seek your patience and understanding in this matter,

    In the meantime, if there’s anything else we can help you with, please let us know.

    We are here to assist.

    Thread Starter Jose

    (@giuse)

    Hi @rankmath

    thank you very much!

    It’s totally normal for a plugin with hundreds of thousands of active installations that it can have a conflict with other plugins.

    A big thank you to the whole Rank Math team for the great support.

    Have a wonderful day.

    Plugin Author Rank Math

    (@rankmath)

    Hello @giuse

    Thank you for your understanding and patience.

    Please update to the latest version. That should fix the issue.

    If not, please let us know and we will be more than happy to assist.

    Take care!

    Thread Starter Jose

    (@giuse)

    Hello @rankmath

    thank you very much for your great support!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error if WooCommerce disabled only on a specific page’ is closed to new replies.