Filter hook 'get_sample_permalink'

in WP Core File wp-admin/includes/post.php at line 1539

View Source

get_sample_permalink

Filter Hook
Description
Filters the sample permalink. }

Hook Information

File Location wp-admin/includes/post.php View on GitHub
Hook Type Filter
Line Number 1539

Hook Parameters

Type Name Description
array $permalink { Array containing the sample permalink with placeholder for the post name, and the post name.
int $post_id Post ID.
string $title Post title.
string $name Post name (slug).
WP_Post $post Post object.

Usage Examples

Basic Usage
<?php
// Hook into get_sample_permalink
add_filter('get_sample_permalink', 'my_custom_filter', 10, 5);

function my_custom_filter($permalink, $post_id, $title, $name, $post) {
    // Your custom filtering logic here
    return $permalink;
}

Source Code Context

wp-admin/includes/post.php:1539 - How this hook is used in WordPress core
<?php
1534  	 * @param int     $post_id Post ID.
1535  	 * @param string  $title   Post title.
1536  	 * @param string  $name    Post name (slug).
1537  	 * @param WP_Post $post    Post object.
1538  	 */
1539  	return apply_filters( 'get_sample_permalink', $permalink, $post->ID, $title, $name, $post );
1540  }
1541  
1542  /**
1543   * Returns the HTML of the sample permalink slug editor.
1544   *

PHP Documentation

<?php
/**
	 * Filters the sample permalink.
	 *
	 * @since 4.4.0
	 *
	 * @param array   $permalink {
	 *     Array containing the sample permalink with placeholder for the post name, and the post name.
	 *
	 *     @type string $0 The permalink with placeholder for the post name.
	 *     @type string $1 The post name.
	 * }
	 * @param int     $post_id Post ID.
	 * @param string  $title   Post title.
	 * @param string  $name    Post name (slug).
	 * @param WP_Post $post    Post object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 5
  • File: wp-admin/includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.