fatal error "Cannot redeclare class OAuthSignatureMethod_HMAC_S with elegant themes extra and d

Comments plus causing fatal error "Cannot redeclare class OAuthSignatureMethod_HMAC_SHA1" with elegant themes extra and divi but works fine with other themes.

Extra and Divi themes working fine with other plugins so may be nothing wrong with those.

  • Adam Czajczyk

    Hello Vin,

    It seems that the theme includes some add-on/plugin that's forcing WP to load some library that's using "OAuthSignaturemethod_HMAC_SHA1" class.

    The issue here is that such class should be called with PHP

    if (!exists

    condition. Our plugin does that so it seems that none of the themes you tried (except default one) does it the proper way. Therefore, if plugin declares class before theme does (which is a default WP workflow) an error comes up.

    That said, it would be great to contact theme developers and point it out to them as it may be causing also other issues with other themes/for other users.

    The "quick and dirty" hack would be to force Comments+ plugin to initialize after the theme is already loaded and setup. Please note however that it's not recommended to edit plugin files directly and it may lead to other unexpected issues. Also the changes may be lost upon plugin's update so that'd be at your own risk.

    The "hack" would be to edit /wp-content/plugins/comments-plus/comments-plus.php file
    and change its last line from

    add_action('plugins_loaded', 'wdcp_initialize');

    to

    add_action('after_setup_theme', 'wdcp_initialize');

    or

    add_action('init', 'wdcp_initialize');

    or

    add_action('wp_loaded', 'wdcp_initialize');

    One of these fixes should do the trick I think. Please make sure though that prior to making changes you made a full backup of your site. Let me also stress out again that this is not a recommended way of fixing the issue and the only solid and WP-compliant solution here would be to convince theme developers to update their themes to declare "OAuthSignaturemethod_HMAC_SHA1" class conditionally.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.