get_canonical_url WordPress Filter Hook

The get_canonical_url hook allows you to change the canonical URL of a post or page. This can be useful if you want to change the URL of a post or page to something different than what is set in the permalink settings.

apply_filters( 'get_canonical_url', string $canonical_url, WP_Post $post ) #

Filters the canonical URL for a post.


Parameters

$canonical_url

(string)The post's canonical URL.

$post

(WP_Post)Post object.


Top ↑

Source

File: wp-includes/link-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More