wp_get_canonical_url

Advertisement

Summery Summery

Returns the canonical URL for a post.

Syntax Syntax

wp_get_canonical_url( int|WP_Post $post = null )

Description Description

When the post is the same as the current requested page the function will handle the pagination arguments too.

Parameters Parameters

$post

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

Default value: null

Return Return

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

Source Source

File: wp-includes/link-template.php


			

Advertisement

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.