WP HOOKS
filtrdynamicznyod 3.1.0

get_{$meta_type}_metadata

Args 5Plik wp-includes/meta.php

Opis — z kodu źródłowego

Short-circuits the return value of a meta field.

The dynamic portion of the hook name, $meta_type, refers to the meta object type (blog, post, comment, term, user, or any other type with an associated meta table). Returning a non-null value will effectively short-circuit the function. Possible filter names include:

  • get_blog_metadata
  • get_post_metadata
  • get_comment_metadata
  • get_term_metadata
  • get_user_metadata

Parametry

ParametrTypOpis
$valuemixedThe value to return, either a single metadata value or an array of values depending on the value of <code>$single</code>. Default null.
$object_idintID of the object metadata is for.
$meta_keystringMetadata key.
$singleboolWhether to return only the first value of the specified <code>$meta_key</code>.
$meta_typestringType of object metadata is for. Accepts 'blog', 'post', 'comment', 'term', 'user', or any other object type with an associated meta table.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'get_{$meta_type}_metadata', 'twoja_funkcja', 10, 5 );

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