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。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$url = apply_filters( 'url_to_postid', $url );
$url = apply_filters( 'url_to_postid', $url );
$url = apply_filters( 'url_to_postid', $url );

常見問題

FAQs
檢視更多 >