get_preview_post_link

SummerySummery

Retrieves the URL used for the post preview.

Syntax

get_preview_post_link( int|WP_Post $post = null, array $query_args = array(), string $preview_link = '' )

DescriptionDescription

Allows additional query args to be appended.

ParametersParameters

$post

(int|WP_Post) (Optional) Post ID or WP_Post object. Defaults to global $post.

Default value: null

$query_args

(array) (Optional) Array of additional query args to be appended to the link.

Default value: array()

$preview_link

(string) (Optional) Base preview link to be used if it should differ from the post permalink.

Default value: ''

ReturnReturn

(string|null) URL used for the post preview, or null if the post does not exist.

SourceSource

File: wp-includes/link-template.php


			

ChangelogChangelog

Changelog
Version Description
4.4.0 Introduced.
Scroll to Top