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
457       * @since 3.1.0
458       *
459       * @param null|array|string $value     The value get_metadata() should
460       *                                     return - a single metadata value,
461       *                                     or an array of values.
462       * @param int               $object_id Object ID.
463       * @param string            $meta_key  Meta key.
464       * @param string|array      $single    Meta value, or an array of values.
465       */
466      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
467      if ( null !== $check ) {
468           if ( $single && is_array( $check ) )
469                return $check[0];
470           else
471                return $check;
472      }
473
474      $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
475
 
Line Code
509           return false;
510      }
511
512      $object_id = absint( $object_id );
513      if ( ! $object_id ) {
514           return false;
515      }
516
517      /** This filter is documented in wp-includes/meta.php */
518      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
519      if ( null !== $check )
520           return (bool) $check;
521
522      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
523
524      if ( !$meta_cache ) {
525           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
526           $meta_cache = $meta_cache[$object_id];
527      }