Bug in function.php. Bad implementation.
-
Hello.
I’m just developing a new plugin called “Hide Comments Feature” which hides from admin area all traces of Comments, so people who don’t need this feature will never see it.
As TwentyTen is the default wordpress theme, I think my plugin must be compatible with it.I have noticed a bad implementation in funtions.php that lead me to this
Notice: Undefined index: WP_Widget_Recent_Comments in /var/www/wordpress/wp-content/themes/twentyten/functions.php on line 431
Actual, this funtion is:
function twentyten_remove_recent_comments_style() { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
But it doesn’t analisys if the
WP_Widget_Recent_Comments
is active. You should do that for compatibility with plugins.Patch:
function twentyten_remove_recent_comments_style() { global $wp_widget_factory; if( isset( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'] ) ) { remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } } add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
Thankyou in advance!
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Bug in function.php. Bad implementation.’ is closed to new replies.