Title: category_css_class
Published: April 23, 2015
Last modified: April 28, 2025

---

# apply_filters( ‘category_css_class’, string[] $css_classes, WP_Term $category, int $depth, array $args )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#changelog)

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

Filters the list of CSS classes to include with each category in the list.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/hooks/category_css_class/?output_format=md#see-also)󠁿

 * [wp_list_categories()](https://developer.wordpress.org/reference/functions/wp_list_categories/)

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

 `$css_classes`string[]

An array of CSS classes to be applied to each list item.

`$category`[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)

Category data object.

`$depth`int

Depth of page, used for padding.

`$args`array

An array of [wp_list_categories()](https://developer.wordpress.org/reference/functions/wp_list_categories/)
arguments.

More Arguments from wp_list_categories( … $args )

Array or string of arguments. See [WP_Term_Query::__construct()](https://developer.wordpress.org/reference/classes/wp_term_query/__construct/)
for information on accepted arguments.

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

    ```php
    $css_classes = implode( ' ', apply_filters( 'category_css_class', $css_classes, $category, $depth, $args ) );
    ```

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

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

| Used by | Description | 
| [Walker_Category::start_el()](https://developer.wordpress.org/reference/classes/walker_category/start_el/)`wp-includes/class-walker-category.php` |

Starts the element output.

  |

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

| Version | Description | 
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |

## User Contributed Notes

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