pre_post_link

過濾鉤子
apply_filters( 'pre_post_link', $permalink, $post, $leavename )
引數
  • (string) $permalink The site's permalink structure.
    Required:
  • (WP_Post) $post The post in question.
    Required:
  • (bool) $leavename Whether to keep the post name.
    Required:
定義位置
相關勾子
preview_post_linkpost_linkedit_post_linkpre_term_linkrespond_link
相關方法
previous_post_linkprev_post_rel_linkprevious_posts_linkedit_post_linknext_post_linkparent_post_rel_link
引入
3.0.0
棄用
-

pre_post_link。這個過濾器是用來在get_permalink函式返回之前過濾固定連結的。它允許開發者在一個文章顯示在前端之前修改它的固定連結。該過濾器接收兩個引數,即文章的固定連結和文章物件。

在發生令牌替換之前,過濾post的permalink結構。

僅適用於post_type為“post”的文章。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );

常見問題

FAQs
檢視更多 >