nav_menu_link_attributes

过滤钩子
apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth )
参数
  • (array) $atts { The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored. @type string $title Title attribute. @type string $target Target attribute. @type string $rel The rel attribute. @type string $href The href attribute. @type string $aria-current The aria-current attribute. }
    Required:
  • (WP_Post) $menu_item The current menu item object.
    Required:
  • (stdClass) $args An object of wp_nav_menu() arguments.
    Required:
  • (int) $depth Depth of menu item. Used for padding.
    Required:
定义位置
相关勾子
page_menu_link_attributesnext_comments_link_attributesprevious_comments_link_attributescomments_popup_link_attributesnext_posts_link_attributes
相关方法
get_language_attributeswp_pre_kses_block_attributesget_nav_menu_locationsserialize_block_attributesis_nav_menu_itemlanguage_attributes
引入
4.1.0
弃用
-

nav_menu_link_attributes: 这个过滤钩子用于过滤导航菜单项中链接元素的HTML属性。该钩子接收属性作为一个参数,并返回过滤后的属性。

过滤应用于菜单项锚定元素的HTML属性。

$atts = apply_filters( 'nav_menu_link_attributes', $atts, $menu_item, $args, $depth );

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-06 02:33:06

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: