Title: widget_categories_args
Published: April 25, 2014
Last modified: February 24, 2026

---

# apply_filters( ‘widget_categories_args’, array $cat_args, array $instance )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#wp--skip-link--target)

Filters the arguments for the Categories widget.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#parameters)󠁿

 `$cat_args`array

An array of Categories widget options.

`$instance`array

Array of settings for the current widget.

## 󠀁[More Information](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#more-information)󠁿

This filter is used by the default “WordPress Widget: Categories” before it passes
arguments to the [wp_list_categories()](https://developer.wordpress.org/reference/functions/wp_list_categories/)
function.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#source)󠁿

    ```php
    wp_list_categories( apply_filters( 'widget_categories_args', $cat_args, $instance ) );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets/class-wp-widget-categories.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/widgets/class-wp-widget-categories.php#L156)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/widgets/class-wp-widget-categories.php#L156-L156)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Widget_Categories::widget()](https://developer.wordpress.org/reference/classes/wp_widget_categories/widget/)`wp-includes/widgets/class-wp-widget-categories.php` |

Outputs the content for the current Categories widget instance.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Added the `$instance` parameter. | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/widget_categories_args/?output_format=md#comment-content-4599)
 2.   [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/widget_categories_args/#comment-4599)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_categories_args%2F%23comment-4599)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_categories_args%2F%23comment-4599)
 4. Example migrated from Codex:
 5. To hide some categories create a filter function in your `functions.php` file and
    hook it to the `widget_categories_args` filter. In this function, add the exclude
    parameter to the arguments list. Currently, in [Version 3.3.2](https://wordpress.org/support/wordpress-version/version-3-3-2/),
    the exclude parameter is not provided, but for future compatibility you should 
    decide how you want to handle an already existing exclude parameter.
 6.     ```php
        add_filter( 'widget_categories_args', 'widget_categories_args_filter', 10, 1 );
    
        function widget_categories_args_filter( $cat_args ) {
        	$exclude_arr = array( 4 );
    
        	if( isset( $cat_args['exclude'] ) && !empty( $cat_args['exclude'] ) )
        		$exclude_arr = array_unique( array_merge( explode( ',', $cat_args['exclude'] ), $exclude_arr ) );
        	$cat_args['exclude'] = implode( ',', $exclude_arr );
        	return $cat_args;
        }
        ```
    
 7.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_categories_args%2F%3Freplytocom%3D4599%23feedback-editor-4599)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwidget_categories_args%2F)
before being able to contribute a note or feedback.