Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
add_filter( 'nav_menu_link_attributes', function ( $atts, $item, $args ) {
$prefix = 'target';
$target_items = preg_grep( "/^${prefix}-/", $classes );
if ( $target_items ) {
foreach( $target_items as $target_item ) {
$value = substr( $target_item, strlen( $prefix.'-' ) );
$atts[$prefix] = $value;
}
}
return $atts;
}, 10, 3 );
@mayishaciyevgithub
Copy link

mayishaciyevgithub commented Aug 13, 2020

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment