Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: page_menu_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
174            *
175            *     @type string $href         The href attribute.
176            *     @type string $aria_current The aria-current attribute.
177            * }
178            * @param WP_Post $page         Page data object.
179            * @param int     $depth        Depth of page, used for padding.
180            * @param array   $args         An array of arguments.
181            * @param int     $current_page ID of the current page.
182            */
183           $atts = apply_filters( 'page_menu_link_attributes', $atts, $page, $depth, $args, $current_page );
184
185           $attributes = '';
186           foreach ( $atts as $attr => $value ) {
187                if ( is_scalar( $value ) && '' !== $value && false !== $value ) {
188                     $value       = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
189                     $attributes .= ' ' . $attr . '="' . $value . '"';
190                }
191           }
192