get_post_custom_values() WP 1.0
Retrieve values for a custom post field.
The parameters must not be considered optional. All of the post meta fields will be retrieved and only the meta field key values returned.
Works based on: get_post_custom()
No Hooks.
Return
Array/null. Meta field values.
Usage
get_post_custom_values( $key, $post_id );
- $key(string)
- Meta field key.
Default: '' - $post_id(int)
- Post ID.
Default: ID of the global $post
Changelog
Since 1.2.0 | Introduced. |
Code of get_post_custom_values() get post custom values WP 5.6
function get_post_custom_values( $key = '', $post_id = 0 ) {
if ( ! $key ) {
return null;
}
$custom = get_post_custom( $post_id );
return isset( $custom[ $key ] ) ? $custom[ $key ] : null;
}Related Functions
From tag: Metadatas (any)
- add_comment_meta()
- add_metadata()
- add_post_meta()
- add_term_meta()
- add_user_meta()
- delete_comment_meta()
- delete_metadata()
- delete_post_meta()
- delete_term_meta()
- delete_user_meta()
- get_comment_meta()