top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

How to display custom field in Wordpress?

0 votes
3 views
posted 5 days ago by Sahana

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

To fetch custom fields or meta values use the get_post_meta() function:

echo get_post_meta($post_id, $key, $single);
  • $post_id is the ID of the post you want the meta values for. Use $post->ID to get a post's ID within the $post variable scope. Use get_the_ID() to retrieve the ID of the current item in the WordPress Loop.

  • $key is a string containing the name of the meta value you want.

  • $single can either be true or false. If set to true then the function will return a single result, as a string. If false, or not set, then the function returns an array of the custom fields.

answer 11 hours ago by Kavyashree
Similar Questions
+1 vote

Recently when I tested one of my WordPress blogs via Google Structured Data testing tools, I got the Following errors:

Error: Missing required field “entry-title”.
Error: Missing required field “updated”.
Error: Missing required hCard “author”.

It was weird, as Everything was already mentioned in my WordPress theme codes, but still I was getting the error and I had to resolve the issue.

Please help me solve this


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...