wp_unique_post_slug_is_bad_flat_slug WordPress Filter Hook

The wp_unique_post_slug_is_bad_flat_slug hook is used to determine whether a post slug is bad for a flat slug. A flat slug is a slug that is not hierarchical. That is, it can not have / characters in it. A bad flat slug is a flat slug that is not unique. This hook is called when a post is saved and the post slug is found to be bad for a flat slug. The hook is passed two arguments: the post ID and the post slug. If the post slug is not unique, the post ID will be returned. Otherwise, false will be returned. This hook can be used to add custom code to handle the case where a post slug is not unique. For example, you could display an error message or redirect the user to a different page.

apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', bool $bad_slug, string $slug, string $post_type ) #

Filters whether the post slug would be bad as a flat slug.


Parameters

$bad_slug

(bool)Whether the post slug would be bad as a flat slug.

$slug

(string)The post slug.

$post_type

(string)Post type.


Top ↑

Source

File: wp-includes/post.php

View on Trac



Top ↑

Changelog

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