get_post_custom()
Retrieve 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.
Uses: get_post_meta()
No Hooks.
Return
Array
. Post meta for the given post.
Usage
get_post_custom( $post_id );
- $post_id(int)
- Post ID.
Default: ID of the global $post
Changelog
Since 1.2.0 | Introduced. |
Code of get_post_custom() get post custom WP 5.9.3
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 ); }