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的值将使短链接生成过程短路,而是返回该值。

$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );

常见问题

FAQs
查看更多 >
闪电侠

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

2026-01-29 11:09:38

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

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

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