get_shortlink хук-фильтрWP 3.0.0

Filters the shortlink for a post.

Использование

add_filter( 'get_shortlink', 'wp_kama_get_shortlink_filter', 10, 4 );

/**
 * Function for `get_shortlink` filter-hook.
 * 
 * @param string $shortlink   Shortlink URL.
 * @param int    $id          Post ID, or 0 for the current post.
 * @param string $context     The context for the link. One of 'post' or 'query',
 * @param bool   $allow_slugs Whether to allow post slugs in the shortlink. Not used by default.
 *
 * @return string
 */
function wp_kama_get_shortlink_filter( $shortlink, $id, $context, $allow_slugs ){

	// filter...
	return $shortlink;
}
$shortlink(строка)
Shortlink URL.
$id(int)
Post ID, or 0 for the current post.
$context(строка)
The context for the link. One of 'post' or 'query',
$allow_slugs(true|false)
Whether to allow post slugs in the shortlink. Not used by default.

Список изменений

С версии 3.0.0 Введена.

Где вызывается хук

wp_get_shortlink()
get_shortlink
wp-includes/link-template.php 4174
return apply_filters( 'get_shortlink', $shortlink, $id, $context, $allow_slugs );

Где используется хук в WordPress

Использование не найдено.