get_the_guid

函式
get_the_guid ( $post = 0 )
引數
  • (int|WP_Post) $post Optional. Post ID or post object. Default is global $post.
    Required:
返回值
  • (string)
定義位置
相關方法
get_the_idthe_guidget_the_author_idget_the_dateget_the_tags
引入
1.5.0
棄用
-

get_the_guid: 該函式檢索當前文章或頁面的全球唯一識別符號(GUID)。它不接受任何引數,以字串形式返回GUID。

檢索文章的全球唯一識別符號(guid)。

該指南將顯示為一個連結,但不應該被用作文章的連結。你不應該把它作為一個連結,原因是要跨域移動部落格。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_the_guid( $post = 0 ) {
$post = get_post( $post );
$post_guid = isset( $post->guid ) ? $post->guid : '';
$post_id = isset( $post->ID ) ? $post->ID : 0;
/**
* Filters the Global Unique Identifier (guid) of the post.
*
* @since 1.5.0
*
* @param string $post_guid Global Unique Identifier (guid) of the post.
* @param int $post_id The post ID.
*/
return apply_filters( 'get_the_guid', $post_guid, $post_id );
}
function get_the_guid( $post = 0 ) { $post = get_post( $post ); $post_guid = isset( $post->guid ) ? $post->guid : ''; $post_id = isset( $post->ID ) ? $post->ID : 0; /** * Filters the Global Unique Identifier (guid) of the post. * * @since 1.5.0 * * @param string $post_guid Global Unique Identifier (guid) of the post. * @param int $post_id The post ID. */ return apply_filters( 'get_the_guid', $post_guid, $post_id ); }
function get_the_guid( $post = 0 ) {
	$post = get_post( $post );

	$post_guid = isset( $post->guid ) ? $post->guid : '';
	$post_id   = isset( $post->ID ) ? $post->ID : 0;

	/**
	 * Filters the Global Unique Identifier (guid) of the post.
	 *
	 * @since 1.5.0
	 *
	 * @param string $post_guid Global Unique Identifier (guid) of the post.
	 * @param int    $post_id   The post ID.
	 */
	return apply_filters( 'get_the_guid', $post_guid, $post_id );
}

常見問題

FAQs
檢視更多 >