Skip to content

Instantly share code, notes, and snippets.

@smonteverdi
Created March 7, 2012 15:42
Show Gist options
  • Save smonteverdi/1993869 to your computer and use it in GitHub Desktop.
Save smonteverdi/1993869 to your computer and use it in GitHub Desktop.
WordPress: Show custom field outside of loop
<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'MyField', true);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment