Support » Theme: Fluxipress » [fix] Error if comments are already disabled

  • If the comments are already disabled by an external plugin*, the (old) widget ‘WP_Widget_Recent_Comments’ might already be unregistered.

    The line 130 of ‘functions.php’ would be fine if it was using a more robust way of removing the widget. Un-setting the widget inside the factory may not be the cleanest way.
    The exact error is: Notice: Undefined index: WP_Widget_Recent_Comments in […]/fluxipress/functions.php on line 130.
    Following is the fixing diff:

    $ diff functions.php.orig functions.php
    < 	global $wp_widget_factory;
    < 	remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
    > 	unregister_widget('WP_Widget_Recent_Comments');
    > 	remove_action('wp_head', 'recent_comments_style');

    * for instance with the ‘Disable Comments’ plugin.

  • The topic ‘[fix] Error if comments are already disabled’ is closed to new replies.