Retrieves post meta fields, based on post ID.
The post meta fields are retrieved from the cache where possible, so the function is optimized to be called more than once.
$post_idintoptional
$post.$post_id (non-numeric, zero, or negative value).See also get_post_custom_keys() and get_post_custom_values()
function get_post_custom( $post_id = 0 ) {
$post_id = absint( $post_id );
if ( ! $post_id ) {
$post_id = get_the_ID();
}
return get_post_meta( $post_id );
}
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_post_custom