get_post_custom_keys() WP 1.0
Retrieve meta field names for a post.
If there are no meta fields, then nothing (null) will be returned.
Works based on: get_post_custom()
Basis of: the_meta()
No Hooks.
Return
Array/null. Array of the keys, if retrieved.
Usage
get_post_custom_keys( $post_id );
- $post_id(int)
- Post ID.
Default: ID of the global $post
Changelog
Since 1.2.0 | Introduced. |
Code of get_post_custom_keys() get post custom keys WP 5.6
function get_post_custom_keys( $post_id = 0 ) {
$custom = get_post_custom( $post_id );
if ( ! is_array( $custom ) ) {
return;
}
$keys = array_keys( $custom );
if ( $keys ) {
return $keys;
}
}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()