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
624       *
625       * @param mixed  $value     The value to return, either a single metadata value or an array
626       *                          of values depending on the value of `$single`. Default null.
627       * @param int    $object_id ID of the object metadata is for.
628       * @param string $meta_key  Metadata key.
629       * @param bool   $single    Whether to return only the first value of the specified `$meta_key`.
630       * @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
631       *                          or any other object type with an associated meta table.
632       */
633      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type );
634      if ( null !== $check ) {
635           if ( $single && is_array( $check ) ) {
636                return $check[0];
637           } else {
638                return $check;
639           }
640      }
641
642      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
 
Line Code
737           return false;
738      }
739
740      $object_id = absint( $object_id );
741      if ( ! $object_id ) {
742           return false;
743      }
744
745      /** This filter is documented in wp-includes/meta.php */
746      $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true, $meta_type );
747      if ( null !== $check ) {
748           return (bool) $check;
749      }
750
751      $meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
752
753      if ( ! $meta_cache ) {
754           $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
755           $meta_cache = $meta_cache[ $object_id ];