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 |
---|---|
263 | * @return string|array Single metadata value, or array of values |
264 | */ |
265 | function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) { |
266 | if ( !$meta_type ) |
267 | return false; |
268 |
|
269 | if ( !$object_id = absint($object_id) ) |
270 | return false; |
271 |
|
272 | $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single ); |
273 | if ( null !== $check ) { |
274 | if ( $single && is_array( $check ) ) |
275 | return $check[0]; |
276 | else |
277 | return $check; |
278 | } |
279 |
|
280 | $meta_cache = wp_cache_get($object_id, $meta_type . '_meta'); |
281 |
|
Line | Code |
311 | * @return boolean true of the key is set, false if not. |
312 | */ |
313 | function metadata_exists( $meta_type, $object_id, $meta_key ) { |
314 | if ( ! $meta_type ) |
315 | return false; |
316 |
|
317 | if ( ! $object_id = absint( $object_id ) ) |
318 | return false; |
319 |
|
320 | $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true ); |
321 | if ( null !== $check ) |
322 | return true; |
323 |
|
324 | $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' ); |
325 |
|
326 | if ( !$meta_cache ) { |
327 | $meta_cache = update_meta_cache( $meta_type, array( $object_id ) ); |
328 | $meta_cache = $meta_cache[$object_id]; |
329 | } |