apply_filters( ‘pre_get_shortlink’, false|string $return, int $id, string $context, bool $allow_slugs )

In this article

Filters whether to preempt generating a shortlink for the given post.

Description

Returning a value other than false from the filter will short-circuit the shortlink generation process, returning that value instead.

Parameters

$returnfalse|string
Short-circuit return value. Either false or a URL string.
$idint
Post ID, or 0 for the current post.
$contextstring
The context for the link. One of 'post' or 'query',
$allow_slugsbool
Whether to allow post slugs in the shortlink.

Source

$shortlink = apply_filters( 'pre_get_shortlink', false, $id, $context, $allow_slugs );

Changelog

VersionDescription
3.0.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.