WP HOOKS
filtrod 4.2.0

pre_get_avatar

Args 3Plik wp-includes/pluggable.phpDokumentacja WP ↗

Opis — z kodu źródłowego

Allows the HTML for a user's avatar to be returned early.

Returning a non-null value will effectively short-circuit get_avatar(), passing the value through the {@see 'get_avatar'} filter and returning early.

Parametry

ParametrTypOpis
$avatarstring | nullHTML for the user's avatar. Default null.
$id_or_emailmixedThe avatar to retrieve. Accepts a user ID, Gravatar MD5 hash, user email, WP_User object, WP_Post object, or WP_Comment object.
$argsarrayArguments passed to get_avatar_url(), after processing.

Wywołanie

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

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

Popularne w tej kategorii