Filter hook 'navigation_widgets_format'

in WP Core File wp-includes/widgets/class-wp-widget-rss.php at line 124

View Source

navigation_widgets_format

Filter Hook
Description
Filters the classic RSS widget's feed icon link. Themes can remove the icon link by using `add_filter( 'rss_widget_feed_link', '__return_empty_string' );`.

Hook Information

File Location wp-includes/widgets/class-wp-widget-rss.php View on GitHub
Hook Type Filter
Line Number 124

Hook Parameters

Type Name Description
string|false $feed_link HTML for link to RSS feed.
array $instance Array of settings for the current widget.

Usage Examples

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

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

Source Code Context

wp-includes/widgets/class-wp-widget-rss.php:124 - How this hook is used in WordPress core
<?php
 119  		}
 120  
 121  		$format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml';
 122  
 123  		/** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */
 124  		$format = apply_filters( 'navigation_widgets_format', $format );
 125  
 126  		if ( 'html5' === $format ) {
 127  			// The title may be filtered: Strip out HTML and make sure the aria-label is never empty.
 128  			$title      = trim( strip_tags( $title ) );
 129  			$aria_label = $title ? $title : __( 'RSS Feed' );

PHP Documentation

<?php
/**
			 * Filters the classic RSS widget's feed icon link.
			 *
			 * Themes can remove the icon link by using `add_filter( 'rss_widget_feed_link', '__return_empty_string' );`.
			 *
			 * @since 5.9.0
			 *
			 * @param string|false $feed_link HTML for link to RSS feed.
			 * @param array        $instance  Array of settings for the current widget.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/widgets/class-wp-widget-rss.php
Related Hooks

Related hooks will be displayed here in future updates.