Skip to content

Instantly share code, notes, and snippets.

@agragregra
Last active October 23, 2019 11:28
Show Gist options
  • Save agragregra/5581bf686d960b4caf4d to your computer and use it in GitHub Desktop.
Save agragregra/5581bf686d960b4caf4d to your computer and use it in GitHub Desktop.
WordPress Get All Custom Fields without _edit_lock, _edit_last, _thumbnail_id
<?php
$custom_fields = get_post_custom($post->ID);
foreach ( $custom_fields as $field_key => $field_values ) {
if(!isset($field_values[0])) continue;
if(in_array($field_key,array("_edit_lock", "_edit_last", "_thumbnail_id"))) continue;
echo "<strong>$field_key:</strong> $field_values[0] <br>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment