get_shortlink WordPress Filter Hook

The get_shortlink hook is used to retrieve the shortlink for a given post. This is useful for creating share links or other links that need to be shortened.

apply_filters( 'get_shortlink', string $shortlink, int $id, string $context, bool $allow_slugs ) #

Filters the shortlink for a post.


Parameters

$shortlink

(string)Shortlink URL.

$id

(int)Post ID, or 0 for the current post.

$context

(string)The context for the link. One of 'post' or 'query',

$allow_slugs

(bool)Whether to allow post slugs in the shortlink. Not used by default.


Top ↑

Source

File: wp-includes/link-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.0.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