WordPress at a glance

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.

Is the basis for: the_meta()
Works based on: get_post_custom()

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: wp-includes/post.php WP 5.2.2

<?php
function get_post_custom_keys( $post_id = 0 ) {
	$custom = get_post_custom( $post_id );

	if ( ! is_array( $custom ) ) {
		return;
	}

	if ( $keys = array_keys( $custom ) ) {
		return $keys;
	}
}

Related Functions

From tag: Metadatas (any)

No comments
    Hello, !     Log In . Register