pre_wp_unique_post_slug WordPress Filter Hook

The pre_wp_unique_post_slug hook is called before a post slug is generated. It allows you to override the default behavior and return a custom slug.

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.


Top ↑

Parameters

$override_slug

(string|null)Short-circuit return value.

$slug

(string)The desired slug (post_name).

$post_ID

(int)Post ID.

$post_status

(string)The post status.

$post_type

(string)Post type.

$post_parent

(int)Post parent ID.


Top ↑

Source

File: wp-includes/post.php

View on Trac



Top ↑

Changelog

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