url_to_postid

过滤钩子
apply_filters( 'url_to_postid', $url )
参数
  • (string) $url The URL to derive the post ID from.
    Required:
定义位置
相关勾子
edit_postget_post_timepre_post_linkregister_postedit_post_link
相关方法
url_to_postidattachment_url_to_postidformat_to_postbulk_edit_postswrite_postget_post_field
引入
2.2.0
弃用
-

“url_to_postid”是一个 WordPress 函数,它返回给定 URL 的文章 ID。 在您需要查找特定 URL 的文章 ID 的情况下(例如,当您使用自定义文章类型或需要查找自定义固定链接结构的文章 ID 时),此功能很有用。

过滤URL以获得文章的ID。

$url = apply_filters( 'url_to_postid', $url );

常见问题

FAQs
查看更多 >
闪电侠

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

2025-12-05 19:32:59

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

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

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