Viewing 1 reply thread
  • Author
    Posts
    • #1840

      I created the demo metabox .It was showing perfectly on the post page.When I tried to retrieve the values using the following code in single.php

      <?php
      echo get_post_meta($post->ID, ‘demo_text’, true);
      echo get_post_meta($post->ID, ‘demo_select’, true);
      echo get_post_meta($post->ID, ‘demo_colorpicker’, true);
      ?>

      it’s showing fatal error

      Fatal error: Call to undefined function get_post_meta() in /home/a4426303/public_html/single.php on line 2

      how to resolve this?

    • #1848
      Steve
      Keymaster

      @tejascreation– get_post_meta() is a standard WordPress function that’s been around since WordPress 1.5, so I’m guessing it has to do with something else.

      Your single.php file seems to be in the root directory of your WordPress install, when it should be in your themes folder. See if moving that file helps.

Viewing 1 reply thread
  • The topic ‘error retrieving the metabox values’ is closed to new replies.