get_post_custom_keys()

You are here:

https://toprankon.com/kby”>

Retrieve meta field names for a post.

Description Description

If there are no meta fields, then nothing (null) will be returned.


Top ↑

Parameters Parameters

$post_id

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


Top ↑

Return Return

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


Top ↑

Source Source

File: wp-includes/post.php

2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
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;
    }
}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.0Introduced.
Was this article helpful?
Dislike 0
Views: 2

Cart

Log in

Create an Account
Back to Top