这是根据中的示例改编的get_post_custom_keys().
function get_public_custom_fields( $post_id = 0 ) {
if ( ! empty( $post_id ) )
$custom_fields = get_post_custom( $post_id );
else
$custom_fields = get_post_custom();
$public_custom_fields = array();
foreach ( $custom_fields as $key => $value ) {
if ( \'_\' != $key{0} )
$public_custom_fields[$key] = $value;
}
return $public_custom_fields;
}