WPDev.one
Core Function
View Source on Trac ↗

wp_get_canonical_url()

wp_get_canonical_url( mixed $post = null )

Returns the canonical URL for a post.

Parameters 1 required

Name / Type Description
(int

| WP_Post) $post Optional. Post ID or object. Default is global `$post`.

Required

Return Value

((string)
(string | false) The canonical URL. False if the post does not exist or has not been published yet.

Function Information

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