category_list_link_attributes
Filters the HTML attributes applied to a category list item's anchor element.
Использование
add_filter( 'category_list_link_attributes', 'wp_kama_category_list_link_attributes_filter', 10, 5 );
/**
* Function for `category_list_link_attributes` filter-hook.
*
* @param array $atts The HTML attributes applied to the list item's `<a>` element, empty strings are ignored.
* @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.
*
* @return array
*/
function wp_kama_category_list_link_attributes_filter( $atts, $category, $depth, $args, $current_object_id ){
// filter...
return $atts;
}
- $atts(массив)
The HTML attributes applied to the list item's <a> element, empty strings are ignored.
-
href(строка)
The href attribute. - title(строка)
The title attribute.
-
- $category(WP_Term)
- Term data object.
- $depth(int)
- Depth of category, used for padding.
- $args(массив)
- An array of arguments.
- $current_object_id(int)
- ID of the current category.
Список изменений
| С версии 5.2.0 | Введена. |
Где вызывается хук
wp-includes/class-walker-category.php 144
$atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id );