Filter hook 'widget_categories_args'

in WP Core File wp-includes/widgets/class-wp-widget-categories.php at line 139

View Source

widget_categories_args

Filter Hook
Description
Filters the arguments for the Categories widget.

Hook Information

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

Hook Parameters

Type Name Description
array $cat_args An array of Categories widget options.
array $instance Array of settings for the current widget.

Usage Examples

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

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

Source Code Context

wp-includes/widgets/class-wp-widget-categories.php:139 - How this hook is used in WordPress core
<?php
 134  				 * @since 4.9.0 Added the `$instance` parameter.
 135  				 *
 136  				 * @param array $cat_args An array of Categories widget options.
 137  				 * @param array $instance Array of settings for the current widget.
 138  				 */
 139  				wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) );
 140  				?>
 141  			</ul>
 142  
 143  			<?php
 144  			if ( 'html5' === $format ) {

PHP Documentation

<?php
/**
				 * Filters the arguments for the Categories widget.
				 *
				 * @since 2.8.0
				 * @since 4.9.0 Added the `$instance` parameter.
				 *
				 * @param array $cat_args An array of Categories widget options.
				 * @param array $instance Array of settings for the current widget.
				 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/widgets/class-wp-widget-categories.php
Related Hooks

Related hooks will be displayed here in future updates.