get_sample_permalink WordPress Filter Hook

The get_sample_permalink hook is fired when a sample permalink is generated. It allows for the modification of the generated permalink before it is returned. This hook is useful for custom post types that need to have a different permalink structure than the default. By hooking into this hook, you can change the generated permalink to match your custom post type's permalink structure.

apply_filters( 'get_sample_permalink', array $permalink, int $post_id, string $title, string $name, WP_Post $post ) #

Filters the sample permalink.


Parameters

$permalink

(array)Array containing the sample permalink with placeholder for the post name, and the post name.

  • (string) The permalink with placeholder for the post name.
  • '1'
    (string) The post name.

$post_id

(int)Post ID.

$title

(string)Post title.

$name

(string)Post name (slug).

$post

(WP_Post)Post object.


Top ↑

Source

File: wp-admin/includes/post.php

View on Trac



Top ↑

Changelog

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