WordPress返回文章元数据值函数:get_post_custom_values
WordPress函数get_post_custom_values返回文章所有元数据的值。 get_post_…
WordPress函数get_post_custom_values返回文章所有元数据的值。
get_post_custom_values( string $key = '', int $post_id )
函数参数
$key
字符串
自定义字段的键
$post_id
整数
文章的ID
函数返回值
Array
(
[0] => 123
)函数使用示例
$mykey_values = get_post_custom_values( 'views' );
foreach ( $mykey_values as $key => $value ) {
echo "$key => $value ( 'views' )<br />";
}扩展阅读
get_post_custom_values()函数位于:wp-includes/post.php
相关函数:
- get_post_custom()
- get_post_custom_keys()
- the_meta()
- get_post_meta()
类别:WordPress函数讲解、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!