WPDev.one
Core Function
View Source on Trac ↗

get_preview_post_link()

get_preview_post_link( mixed $post = null, mixed $query_args = array(), mixed $preview_link = '' )

Retrieves the URL used for the post preview.

Parameters 3 required

Name / Type Description
(int

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

Required
array

$query_args Optional. Array of additional query args to be appended to the link. Default empty array.

Required
string

$preview_link Optional. Base preview link to be used if it should differ from the post permalink. Default empty.

Required

Return Value

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

Function Information

Since Version
4.4.0
Source File
wp-includes/link-template.php
Advertisement