src/Codeception/Module/WPDb.php
public function grabPostMetaFromDatabase($postId, $metaKey, $single = false)
    {
        $postmeta = $this->grabPostmetaTableName();
        $grabbed = (array)$this->grabColumnFromDatabase(
            $postmeta,
            'meta_value',
            ['post_id' => $postId, 'meta_key' => $metaKey]
        );
        $values = array_reduce($grabbed, function (array $metaValues, $value) {
            $values = (array)$this->maybeUnserialize($value);
            array_push($metaValues, ...$values);
            return $metaValues;
        }, []);

        return (bool)$single ? $values[0] : $values;
    }
public function grabPostMetaFromDatabase($postId, $metaKey, $single = false)
    {
        $postmeta = $this->grabPostmetaTableName();
        $grabbed = (array)$this->grabColumnFromDatabase(
            $postmeta,
            'meta_value',
            ['post_id' => $postId, 'meta_key' => $metaKey]
        );
        $values = array_reduce($grabbed, function (array $metaValues, $value) {
            $values = (array)$this->maybeUnserialize($value);
            array_push($metaValues, ...$values);
            return $metaValues;
        }, []);

        return (bool)$single ? $values[0] : $values;
    }
public function grabPostMetaFromDatabase ( $ postId , $ metaKey , $ single = false ) { $ postmeta = $ this -> grabPostmetaTableName ( ) ; $ grabbed = ( array ) $ this -> grabColumnFromDatabase ( $ postmeta , 'meta_value' , [ 'post_id' => $ postId , 'meta_key' => $ metaKey ] ) ; $ values = array_reduce ( $ grabbed , function ( array $ metaValues , $ value ) { $ values = ( array ) $ this -> maybeUnserialize ( $ value ) ; array_push ( $ metaValues , ... $ values ) ; return $ metaValues ; } , [ ] ) ; return ( bool ) $ single ? $ values [ 0 ] : $ values ; }
Gets the value of one or more post meta values from the database.

@example
```php
$thumbnail_id = $I->grabPostMetaFromDatabase($postId, '_thumbnail_id', true);
```

@param int    $postId  The post ID.
@param string $metaKey The key of the meta to retrieve.
@param bool   $single  Whether to return a single meta value or an arrya of all available meta values.

@return mixed|array Either a single meta value or an array of all the available meta values.
Gets the value of one or more post meta values from the database .