wppaste
WordPress

get_post_custom_values( string $key = '', int $post_id = 0 ): array|null

Since
1.2.0
Source
wp-includes/post.php:2850
Retrieves values for a custom post field.

Description

The parameters must not be considered optional. All of the post meta fields will be retrieved and only the meta field key values returned.

Parameters

$keystringoptional
Meta field key. Default empty.Default: ''
$post_idintoptional
Post ID. Default is the ID of the global $post.Default: 0

Return

array|null
Meta field values.

Uses · 1

Used by · 1

Source

function get_post_custom_values( $key = '', $post_id = 0 ) {	if ( ! $key ) {		return null;	} 	$custom = get_post_custom( $post_id ); 	return $custom[ $key ] ?? null;}

History

Introduced in 1.2.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/post.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.