Skip to content

Instantly share code, notes, and snippets.

@apatton-cnet
Last active December 20, 2015 05:49
Show Gist options
  • Save apatton-cnet/6081018 to your computer and use it in GitHub Desktop.
Save apatton-cnet/6081018 to your computer and use it in GitHub Desktop.
<?php
function my_plugin_get_custom_fields($post_id) {
$data = get_post_custom($post_id);
foreach ($data as $k => $v) {
$return[$k] = $v[0];
}
return $return;
}
$custom_fields = my_plugin_get_custom_fields($post_id);
extract($custom_fields, EXTR_OVERWRITE );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment