Filter hook 'show_recent_comments_widget_style'

in WP Core File wp-includes/widgets/class-wp-widget-recent-comments.php at line 54

View Source

show_recent_comments_widget_style

Filter Hook
Description
Filters the Recent Comments default widget styles.

Hook Information

File Location wp-includes/widgets/class-wp-widget-recent-comments.php View on GitHub
Hook Type Filter
Line Number 54

Hook Parameters

Type Name Description
bool $active Whether the widget is active. Default true.
string $id_base The widget ID.

Usage Examples

Basic Usage
<?php
// Hook into show_recent_comments_widget_style
add_filter('show_recent_comments_widget_style', 'my_custom_filter', 10, 2);

function my_custom_filter($active, $id_base) {
    // Your custom filtering logic here
    return $active;
}

Source Code Context

wp-includes/widgets/class-wp-widget-recent-comments.php:54 - How this hook is used in WordPress core
<?php
  49  		 *
  50  		 * @param bool   $active  Whether the widget is active. Default true.
  51  		 * @param string $id_base The widget ID.
  52  		 */
  53  		if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876.
  54  			|| ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) {
  55  			return;
  56  		}
  57  
  58  		$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
  59  

PHP Documentation

<?php
/**
		 * Filters the Recent Comments default widget styles.
		 *
		 * @since 3.1.0
		 *
		 * @param bool   $active  Whether the widget is active. Default true.
		 * @param string $id_base The widget ID.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/widgets/class-wp-widget-recent-comments.php
Related Hooks

Related hooks will be displayed here in future updates.