attachment_link

過濾鉤子
apply_filters( 'attachment_link', $link, $post->ID )
引數
  • (string) $link The attachment's permalink.
    Required:
  • (int) $post_id Attachment ID.
    Required:
定義位置
相關勾子
comment_linkget_comment_linkget_comments_linkedit_comment_linkpost_comments_link
相關方法
the_attachment_linkget_attachment_linkthe_attachment_links_fix_attachment_linkswp_get_attachment_linkget_the_attachment_link
引入
5.6.0
棄用
-

attachment_link: 這個過濾器允許開發者修改WordPress中附件的連結。這可以用來改變附件所顯示的URL。

過濾附件的固定連結。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
return apply_filters( 'attachment_link', $link, $post->ID );
return apply_filters( 'attachment_link', $link, $post->ID );
return apply_filters( 'attachment_link', $link, $post->ID );

常見問題

FAQs
檢視更多 >