wppaste
WordPress

apply_filters( 'category_list_link_attributes', array $atts, WP_Term $category, int $depth, array $args, int $current_object_id )

Since
5.2.0
Filters the HTML attributes applied to a category list item's anchor element.

Compatibility

WordPress
since 5.2.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

$attsarray
{ The HTML attributes applied to the list item's <a> element, empty strings are ignored.
@type string $href The href attribute.
@type string $title The title attribute.
}
  • $hrefstring

    The href attribute.
  • $titlestring

    The title attribute.
$categoryWP_Term
Term data object.
$depthint
Depth of category, used for padding.
$argsarray
An array of arguments.
$current_object_idint
ID of the current category.

Where this hook fires · 1

  • wp-includes/class-walker-category.php:144Walker_Category::start_el()

Source code

		 * }		 * @param WP_Term $category          Term data object.		 * @param int     $depth             Depth of category, used for padding.		 * @param array   $args              An array of arguments.		 * @param int     $current_object_id ID of the current category.		 */		$atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id ); 		$attributes = '';		foreach ( $atts as $attr => $value ) {			if ( is_scalar( $value ) && '' !== $value && false !== $value ) {				$value       = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );				$attributes .= ' ' . $attr . '="' . $value . '"';

Changelog

Introduced in 5.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 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.