Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: category_list_link_attributes

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
135            *
136            *     @type string $href  The href attribute.
137            *     @type string $title The title attribute.
138            * }
139            * @param WP_Term $category          Term data object.
140            * @param int     $depth             Depth of category, used for padding.
141            * @param array   $args              An array of arguments.
142            * @param int     $current_object_id ID of the current category.
143            */
144           $atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id );
145
146           $attributes = '';
147           foreach ( $atts as $attr => $value ) {
148                if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
149                     $value       = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
150                     $attributes .= ' ' . $attr . '="' . $value . '"';
151                }
152           }
153