apply_filters( ‘pre_wp_unique_post_slug’, string|null $override_slug, string $slug, int $post_id, string $post_status, string $post_type, int $post_parent )

In this article

Filters the post slug before it is generated to be unique.

Description

Returning a non-null value will short-circuit the unique slug generation, returning the passed value instead.

Parameters

$override_slugstring|null
Short-circuit return value.
$slugstring
The desired slug (post_name).
$post_idint
Post ID.
$post_statusstring
The post status.
$post_typestring
Post type.
$post_parentint
Post parent ID.

Source

$override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_id, $post_status, $post_type, $post_parent );

Changelog

VersionDescription
5.1.0Introduced.

User Contributed Notes

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