category_list_link_attributes

過濾鉤子
apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id )
引數
  • (array) $atts { The HTML attributes applied to the list item's `<a>` element, empty strings are ignored. @type string $href The href attribute. @type string $title The title attribute. }
    Required:
  • (WP_Term) $category Term data object.
    Required:
  • (int) $depth Depth of category, used for padding.
    Required:
  • (array) $args An array of arguments.
    Required:
  • (int) $current_object_id ID of the current category.
    Required:
定義位置
相關勾子
next_posts_link_attributespage_menu_link_attributesprevious_posts_link_attributesnav_menu_link_attributesprevious_comments_link_attributes
相關方法
serialize_block_attributesthe_title_attributeget_language_attributesget_category_rss_linkcategory_existsget_category_link
引入
5.2.0
棄用
-

category_list_link_attributes: 這是WordPress的一個過濾鉤子,允許開發者修改HTML輸出中的類別連結的屬性。category_list_link_attributes鉤子將預設的屬性作為一個引數傳遞,鉤子函式可以返回一個修改後的屬性陣列來代替。這對於為HTML輸出中的類別連結新增自定義樣式或行為很有用。

過濾應用於類別列表項的錨元素的HTML屬性。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id );
$atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id );
$atts = apply_filters( 'category_list_link_attributes', $atts, $category, $depth, $args, $current_object_id );

常見問題

FAQs
檢視更多 >