Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_{$meta_type}_metadata

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
267  * @return string|array Single metadata value, or array of values
268  */
269 function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
270      if ( !$meta_type )
271           return false;
272
273      if ( !$object_id = absint($object_id) )
274           return false;
275
276      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
277      if ( null !== $check ) {
278           if ( $single && is_array( $check ) )
279                return $check[0];
280           else
281                return $check;
282      }
283
284      $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
285
 
Line Code
315  * @return boolean true of the key is set, false if not.
316  */
317 function metadata_exists( $meta_type, $object_id, $meta_key ) {
318      if ( ! $meta_type )
319           return false;
320
321      if ( ! $object_id = absint( $object_id ) )
322           return false;
323
324      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
325      if ( null !== $check )
326           return true;
327
328      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
329
330      if ( !$meta_cache ) {
331           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
332           $meta_cache = $meta_cache[$object_id];
333      }