pre_get_shortlink

過濾鉤子
apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs )
引數
  • (false|string) $return Short-circuit return value. Either false or a URL string.
    Required:
  • (int) $id Post ID, or 0 for the current post.
    Required:
  • (string) $context The context for the link. One of 'post' or 'query',
    Required:
  • (bool) $allow_slugs Whether to allow post slugs in the shortlink.
    Required:
定義位置
相關勾子
get_shortlinkthe_shortlinkpre_get_sitespre_get_search_formpre_get_networks
相關方法
wp_get_shortlinkget_shortcut_linkthe_shortlinkget_author_linkwp_get_linksget_month_link
引入
3.0.0
棄用
-

pre_get_shortlink – 這個鉤子在檢索短連結的URL之前被呼叫。開發人員可以使用這個鉤子來修改短連結或提供一個自定義的短連結。

篩選是否搶先為給定文章生成短連結。

從過濾器中返回一個非false的值將使短連結生成過程短路,而是返回該值。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );
$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );

常見問題

FAQs
檢視更多 >