感谢上帝。。我已经自己解决了。这是我用来更新锚标签的函数。
function my_walker_nav($item_output, $item, $depth, $args) {
$menu_locations = get_nav_menu_locations();
if(!empty( $item->description ))
$description = $item->description;
else {
$description = \'\';
}
if ($item->menu_order == 1){
$item_output = preg_replace(\'/<a /\', \'<a data-scroll-nav="\'.$description.\'" \', $item_output, 1);
}
return $item_output;
}
add_filter(\'walker_nav_menu_start_el\', \'my_walker_nav\', 10, 4);