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