apply_filters( 'page_css_class', string[] $css_class, WP_Post $page, int $depth, array $args, int $current_page_id )
- Since
- 2.8.0
Filters the list of CSS classes to include with each page item in the list.
Compatibility
- WordPress
- since 2.8.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$css_classstring[]- An array of CSS classes to be applied to each list item.
$pageWP_Post- Page data object.
$depthint- Depth of page, used for padding.
$argsarray- An array of arguments.
$current_page_idint- ID of the current page.
Where this hook fires · 2
wp-content/themes/twentytwenty/classes/class-twentytwenty-walker-page.php:71TwentyTwenty_Walker_Page::start_el()wp-includes/class-walker-page.php:159Walker_Page::start_el()
Source code
* @param string[] $css_class An array of CSS classes to be applied to each list item. * @param WP_Post $page Page data object. * @param int $depth Depth of page, used for padding. * @param array $args An array of arguments. * @param int $current_page_id ID of the current page. */ $css_classes = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page_id ) ); $css_classes = $css_classes ? ' class="' . esc_attr( $css_classes ) . '"' : ''; if ( '' === $page->post_title ) { /* translators: %d: ID of a post. */ $page->post_title = sprintf( __( '#%d (no title)' ), $page->ID ); }Changelog
Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.