WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 265 | * @return string|array Single metadata value, or array of values |
| 266 | */ |
| 267 | function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) { |
| 268 | if ( !$meta_type ) |
| 269 | return false; |
| 270 | |
| 271 | if ( !$object_id = absint($object_id) ) |
| 272 | return false; |
| 273 | |
| 274 | $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single ); |
| 275 | if ( null !== $check ) { |
| 276 | if ( $single && is_array( $check ) ) |
| 277 | return $check[0]; |
| 278 | else |
| 279 | return $check; |
| 280 | } |
| 281 | |
| 282 | $meta_cache = wp_cache_get($object_id, $meta_type . '_meta'); |
| 283 | |
| Line | Code |
| 313 | * @return boolean true of the key is set, false if not. |
| 314 | */ |
| 315 | function metadata_exists( $meta_type, $object_id, $meta_key ) { |
| 316 | if ( ! $meta_type ) |
| 317 | return false; |
| 318 | |
| 319 | if ( ! $object_id = absint( $object_id ) ) |
| 320 | return false; |
| 321 | |
| 322 | $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true ); |
| 323 | if ( null !== $check ) |
| 324 | return true; |
| 325 | |
| 326 | $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); |
| 327 | |
| 328 | if ( !$meta_cache ) { |
| 329 | $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); |
| 330 | $meta_cache = $meta_cache[$object_id]; |
| 331 | } |