WordPress filter hook · part of WordPress core
category_list_link_attributes
A WordPress core filter that 2 plugins also fire themselves, running on 1,010+ sites between them.
“Filters the HTML attributes applied to a category list item's anchor element.”
How to use category_list_link_attributes
It's a filter: your callback receives the value and 4 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'category_list_link_attributes', function( $atts, $category, $depth, $args, $id ) {
// Change $atts here.
return $atts;
}, 10, 5 );Argument names come from NS Category Widget's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
2 plugins that fire category_list_link_attributes
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
NS Category Widget1,000+ installs
apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $id )app/Extension/CategoryWalker.php:72 -
UNIVERSAM10+ installs
apply_filters( 'category_list_link_attributes', $atts, $item, $args, $depth )includes/taxonomy/class-walker-map-list.php:100
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.