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
471       * @since 3.1.0
472       *
473       * @param null|array|string $value     The value get_metadata() should
474       *                                     return - a single metadata value,
475       *                                     or an array of values.
476       * @param int               $object_id Object ID.
477       * @param string            $meta_key  Meta key.
478       * @param string|array      $single    Meta value, or an array of values.
479       */
480      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
481      if ( null !== $check ) {
482           if ( $single && is_array( $check ) )
483                return $check[0];
484           else
485                return $check;
486      }
487
488      $meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
489
 
Line Code
524           return false;
525      }
526
527      $object_id = absint( $object_id );
528      if ( ! $object_id ) {
529           return false;
530      }
531
532      /** This filter is documented in wp-includes/meta.php */
533      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
534      if ( null !== $check )
535           return (bool) $check;
536
537      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
538
539      if ( !$meta_cache ) {
540           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
541           $meta_cache = $meta_cache[$object_id];
542      }