On this page
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 )
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
File: wp-includes/post.php. View all references
$override_slug = apply_filters( 'pre_wp_unique_post_slug', null, $slug, $post_ID, $post_status, $post_type, $post_parent );
Related
Used By
| Used By | Description |
|---|---|
| wp_unique_post_slug() wp-includes/post.php | Computes a unique slug for the post, when given the desired slug and some post details. |
Changelog
| Version | Description |
|---|---|
| 5.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/pre_wp_unique_post_slug