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
439       * @since 3.1.0
440       *
441       * @param null|array|string $value     The value get_metadata() should
442       *                                     return - a single metadata value,
443       *                                     or an array of values.
444       * @param int               $object_id Object ID.
445       * @param string            $meta_key  Meta key.
446       * @param string|array      $single    Meta value, or an array of values.
447       */
448      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
449      if ( null !== $check ) {
450           if ( $single && is_array( $check ) )
451                return $check[0];
452           else
453                return $check;
454      }
455
456      $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
457
 
Line Code
488  */
489 function metadata_exists( $meta_type, $object_id, $meta_key ) {
490      if ( ! $meta_type )
491           return false;
492
493      if ( ! $object_id = absint( $object_id ) )
494           return false;
495
496      /** This filter is documented in wp-includes/meta.php */
497      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
498      if ( null !== $check )
499           return (bool) $check;
500
501      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
502
503      if ( !$meta_cache ) {
504           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
505           $meta_cache = $meta_cache[$object_id];
506      }