
如何在WordPress中编辑CSS(编辑、添加和自定义网站的外观)
get_post_custom_values ( $key = '', $post_id = 0 )
get_post_custom_values函数用于检索给定文章的自定义字段的所有值的数组。它有两个参数:第一个参数是自定义字段的键,第二个参数是文章的ID。
检索自定义文章字段的值。
参数不能被认为是可选的。所有的文章元字段都会被检索到,并且只返回元字段的关键值。
function get_post_custom_values( $key = '', $post_id = 0 ) { if ( ! $key ) { return null; } $custom = get_post_custom( $post_id ); return isset( $custom[ $key ] ) ? $custom[ $key ] : null; }