the_guid()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
the_guid( int|WP_Post $post )
Описание
guid выглядит как ссылка, но не должен использоваться как ссылка на запись. Причина, по которой его не следует использовать как ссылку, — возможный перенос блога между доменами.
URL экранируется, чтобы быть безопасным для XML.
Оригинал (английский)
The guid will appear to be a link, but should not be used as a link to the post. The reason you should not use it as a link, is because of moving the blog across domains.
URL is escaped to make it XML-safe.
Параметры
$post
int|WP_Post
необязательный
Исходный код
wp-includes/post-template.php:190
function the_guid( $post = 0 ) {
$post = get_post( $post );
$post_guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
$post_id = $post->ID ?? 0;
/**
* Filters the escaped Global Unique Identifier (guid) of the post.
*
* @since 4.2.0
*
* @see get_the_guid()
*
* @param string $post_guid Escaped Global Unique Identifier (guid) of the post.
* @param int $post_id The post ID.
*/
echo apply_filters( 'the_guid', $post_guid, $post_id );
}
История изменений
| Версия | Описание |
|---|---|
| 1.5.0 | Introduced. |

