HTTP/2 301
server: nginx
date: Mon, 29 Dec 2025 23:48:12 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/functions/post_custom/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
HTTP/2 200
server: nginx
date: Mon, 29 Dec 2025 23:48:13 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
post_custom() – Function | Developer.WordPress.org
post_custom( string $key = '' ): array|string|false
Retrieves post custom meta data field.
$keystringoptionalMeta data key name.
Default:''
array|string|false Array of values, or single value if only one element exists.
False if the key does not exist.
function post_custom( $key = '' ) {
$custom = get_post_custom();
if ( ! isset( $custom[ $key ] ) ) {
return false;
} elseif ( 1 === count( $custom[ $key ] ) ) {
return $custom[ $key ][0];
} else {
return $custom[ $key ];
}
}
View all references View on Trac View on GitHub
| Version | Description |
|---|
| 1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.