[英]Wordpress: shortcode doesn't work when getting post content using function get_post_field()
[英]How to get single post id when calling a function using shortcode in WordPress
我正在嘗試獲取由短代碼調用的 PHP function 中的單個帖子 ID。
請幫助我獲得單個帖子 ID。
提前致謝!
要獲取當前帖子的 ID,可以使用以下代碼。 global $post; $post_id = is_object( $post ) && isset( $post->ID )? $post->ID: 0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.