wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



get_post_custom › WordPress Function

Da1.2.0
Deprecaton/a
› get_post_custom ( $post_id = 0 )
Parametri:
  • (int) $post_id Optional. Post ID. Default is the ID of the global `$post`.
    Richiesto: No
    Default: —
Ritorna:
  • (array<string|int,array<int,string>>|false) Array of post meta values keyed by meta key, or false on failure.
    Post meta values will always be strings, even for values which
    would otherwise be retrieved individually as arrays or objects
    via {@see get_post_meta()}. A meta key which is a numeric string
    is keyed by the equivalent integer, as PHP casts such array keys.
    An empty array is returned if the post has no post meta.
Definito a:
Codex:

Retrieves 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.


Sorgenti

function get_post_custom( $post_id = 0 ) {
	$post_id = absint( $post_id );

	if ( ! $post_id ) {
		$post_id = get_the_ID();
		if ( false === $post_id ) {
			return false;
		}
	}

	return get_post_meta( $post_id );
}