WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to piece together a Metabox with 3 text editor fields for a custom post type.

The box is showing up and appears to be saving on the custom post type entries but I can't get the data to display on the single-[custom-post-type].php page.

Most recently I have tried the following to get the meta box data to display on the page:

global $post;
$meta = get_post_meta($post->ID, 'my-info', true ); 
if($meta != '') {
echo $meta
}else { 
echo "Can't Display The Content";

I'm not sure if it's a problem with my Metabox creation/save that I can't get it to display. If anyone can point me in the right direction I'd appreciate it.

Here is a link to the code that I'm using for my Metabox if it helps:

Metabox Code

share|improve this question
Any progress on that question? – kaiser Oct 22 '13 at 10:30

To show post type meta data on a single page template, I assume that you're in the Loop.

// Use get_the_ID() to get the ID via the API function
echo get_post_meta( get_the_ID(), 'my-info', true );
// You can also call it from the global, as the query refers to the current single page
echo get_post_meta( $GLOBALS['post']->ID, 'my-info', true );

If you're not getting any output, then you might want to check your complete set of post custom data:

printf( '<pre>%s</pre>', var_export( get_post_custom( get_the_ID() ), true ) );
share|improve this answer

Use IDs of fields to get meta data of respective fields as following code.

global $post;
$meta = get_post_meta($post->ID,'myinfo-box1', true); // Use myinfo-box1, myinfo-box2, myinfo-box3 for respective fields
if($meta != '') {
echo $meta;
}else { 
echo "Can't Display The Content";
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.