Tribe__Utils__Post_Collection::pluck_meta( string $meta_key, bool $single = true )
Plucks a meta key for all elements in the collection.
Contents
Elements that are not posts or do not have the meta set will have an empty string value.
Parameters
- $meta_key
-
(string) (Required) The meta key to pluck.
- $single
-
(bool) (Optional) Whether to fetch the meta key as single or not.
Default value: true
Return
(array) An array of meta values for each item in the collection; items that do not have the meta set or that are not posts, will have an empty string value.
Source
File: src/Tribe/Utils/Post_Collection.php
public function pluck_meta( $meta_key, $single = true ) { $plucked = array(); foreach ( $this as $item ) { $plucked[] = get_post_meta( $item->ID, $meta_key, $single ); } return $plucked; }
Changelog
Version | Description |
---|---|
4.9.5 | Introduced. |