Skip to main content

get_post_id_from_source_url()

public static function get_post_id_from_source_url( $url )

Resolves the post a submission URL or referer points to, without trusting submitter-supplied query arguments.

Ensures that merge tags show data from the submission URL, not from a page embedded in a query argument, to prevent merge tags from revealing private or non-public data.

Since: next

Source: common.php:1644

Parameters​

NameTypeDefaultDescription
$urlstringThe submission URL or referer.

Returns​

  • int — The post ID, or 0 when the URL does not resolve to a post the current user may view.