WP HOOKS
filtrod 3.0.0

pre_get_shortlink

Args 4Plik wp-includes/link-template.phpDokumentacja WP ↗

Opis — z kodu źródłowego

Filters whether to preempt generating a shortlink for the given post.

Returning a value other than false from the filter will short-circuit the shortlink generation process, returning that value instead.

Parametry

ParametrTypOpis
$returnfalse | stringShort-circuit return value. Either false or a URL string.
$idintPost ID, or 0 for the current post.
$contextstringThe context for the link. One of 'post' or 'query',
$allow_slugsboolWhether to allow post slugs in the shortlink.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'pre_get_shortlink', 'twoja_funkcja', 10, 4 );

function twoja_funkcja($param_1, $param_2, $param_3, $param_4) {
	// Twój kod
}

Popularne w tej kategorii