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
477       *
478       * @since 3.1.0
479       *
480       * @param null|array|string $value     The value get_metadata() should return - a single metadata value,
481       *                                     or an array of values.
482       * @param int               $object_id Object ID.
483       * @param string            $meta_key  Meta key.
484       * @param bool              $single    Whether to return only the first value of the specified $meta_key.
485       */
486      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
487      if ( null !== $check ) {
488           if ( $single && is_array( $check ) )
489                return $check[0];
490           else
491                return $check;
492      }
493
494      $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
495
 
Line Code
530           return false;
531      }
532
533      $object_id = absint( $object_id );
534      if ( ! $object_id ) {
535           return false;
536      }
537
538      /** This filter is documented in wp-includes/meta.php */
539      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
540      if ( null !== $check )
541           return (bool) $check;
542
543      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
544
545      if ( !$meta_cache ) {
546           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
547           $meta_cache = $meta_cache[$object_id];
548      }