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
505       *
506       * @since 3.1.0
507       *
508       * @param null|array|string $value     The value get_metadata() should return - a single metadata value,
509       *                                     or an array of values.
510       * @param int               $object_id ID of the object metadata is for.
511       * @param string            $meta_key  Metadata key.
512       * @param bool              $single    Whether to return only the first value of the specified $meta_key.
513       */
514      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
515      if ( null !== $check ) {
516           if ( $single && is_array( $check ) ) {
517                return $check[0];
518           } else {
519                return $check;
520           }
521      }
522
523      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
 
Line Code
566           return false;
567      }
568
569      $object_id = absint( $object_id );
570      if ( ! $object_id ) {
571           return false;
572      }
573
574      /** This filter is documented in wp-includes/meta.php */
575      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
576      if ( null !== $check ) {
577           return (bool) $check;
578      }
579
580      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
581
582      if ( ! $meta_cache ) {
583           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
584           $meta_cache = $meta_cache[ $object_id ];