post_custom

函数
post_custom ( $key = '' )
参数
  • (string) $key Meta data key name.
    Required:
    Default: (empty)
返回值
  • (array|string|false) Array of values, or single value if only one element exists. False if the key does not exist.
定义位置
相关方法
get_post_customget_post_custom_keyspost_custom_meta_boxpost_classget_post_custom_values
引入
1.5.0
弃用
-

post_custom: 这个函数用来检索具有指定ID的文章的自定义文章数据。

检索文章的自定义元数据字段。

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

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 20:36:40

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: