get_post_custom_keys()

最后更新于:2021-11-26 22:28:43

get_post_custom_keys( int$post_id)

Retrieve meta field names for a post.

参数

$post_id

(int) (Optional) Post ID. Default is ID of the global $post.

响应

(array|void) Array of the keys, if retrieved.

源文件

文件: gc-includes/post.php

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;
	}
}