nav_menu_submenu_css_class过滤子菜单ul元素的class属性

apply_filters( 'nav_menu_submenu_css_class', string[] $classes, stdClass $args, int $depth )
参数说明类型可选值默认值
$classes应用于菜单ul元素的CSS类的数组string
$args参数的对象wp_nav_menu()
$depth菜单项的深度int
add_filter('nav_menu_submenu_css_class', function ($classes) {
  $classes = preg_replace('/sub-menu/i', 'dropdown-menu', $classes);
  return $classes;
});
评论
:broken_heart: :confounded: :flushed: :frowning: :grinning: :heart: :kissing_heart: :mask: :pensive: :rage: :relaxed: :scream: :smile: :smirk: :sob: :stuck_out_tongue_closed_eyes: :stuck_out_tongue_winking_eye: :wink: