Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Displaying Meta Box Image

I don’t know exactly how that plugin works, and you have posted code that is probably missing context but you need to define $post_meta_data before running line:

$custom_image = $post_meta_data['image'][0];

It seems that the plugin is using post meta so you should need something like this:

<?php echo get_post_meta($post->ID, $prefix.'hjemmeside', true); ?>

But rewritten to save the data as a variable instead of echo it. Guessing based on the code you posted, I believe you need:

$post_meta_data = get_post_meta($post->ID, $prefix.'image', true);
if (!empty($post_meta_data[0])) {
  $custom_image =  wp_get_attachment_image($post_meta_data[0], 'thumbnail');
}
echo $custom_image; // if desired

Untested, but stands a good chance of working.

Related Posts:

  1. Detect meta value changes when post is updated (post_updated)
  2. Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
  3. Populate Custom Fields in a Custom Post Type?
  4. How to check if user meta field is empty in conditional else statement
  5. A better way to add a meta box to custom post types
  6. create custom meta box with default value
  7. How to show custom field on specific custom post type posts only when filled
  8. How can I output WPAlchemy repeating fields meta values in my page template?
  9. Add a class to post_class if more than one post shares same meta_value_num
  10. Add a meta field to the list of results for a custom post type
  11. Empty meta-box returns publishdate if no value is set?
  12. Custom Post Type meta data getting deleted on bulk editing taxonomies
  13. Delete custom post type metadata without deleting the post in admin area
  14. Visual editor issue by having multiple tiny mce editors in a CPT
  15. Update Post Meta for a logged in user
  16. Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
  17. Plugin – Combine Meta Box Input Fields into single saveble record
  18. Two Custom Post Types Many to Many Relationship
  19. get_post_meta not working on publishing
  20. Meta Query Filtering not working on Custom Meta Box using Radio Buttons
  21. How do I set all of a particular post meta to a value within the custom post type I’m in?
  22. Grouping metadatas into one
  23. Metabox not show in categories custom post type cmb2
  24. Repeatable Fields Metabox with Textarea (or wp_editor)
  25. How to use TinyMCE Editor for one of my custom post meta field?
  26. Custom fields (wp_post_meta) vs Custom Table for large amount of data
  27. Show Custom Post Type meta boxes only on Page Edit
  28. Cannot save CPT meta box
  29. Adding Page Templates to post but it ignored it
  30. Importing Data from a Non-WordPress database, into WP
  31. Permalinks: custom structure for taxonomy – tags?
  32. Can’t publish custom post type – “You are not allowed to edit this post.”
  33. Custom fields for custom post type
  34. Custom “radio button meta box” not saving correctly
  35. Meta Data for Custom Post Type not saving
  36. Add additional field to custom post_type
  37. Custom Post Meta from custom metaboxes is randomly being deleted
  38. Check if post with same meta value exists
  39. Add a custom meta box for client to order CPT posts how they want
  40. Submitting Custom Post Types with custom fields from Front-end form
  41. Display Repeatable Meta Box Content
  42. Displaying a div from an assigned meta_value when on a page
  43. List of users that clicked a ‘Join’ button at single post
  44. How to Echo Metadata Value in Currency Format
  45. Issue on Working with Metabox – Checkbox to enable Sale Items
  46. delete_post_meta() for whole CPT / multiple posts?
  47. How to get specific post meta by title or id
  48. What do the numbers mean at the end of add_action(‘save_post’)…?
  49. A meta box (in a custom post type) with two different type of fields
  50. Why do I have to press the “Update” button twice to save my meta box values?
  51. Inserting custom fields into single.php
  52. hide specific div on single.php [closed]
  53. Values from meta-box not on $_POST
  54. Custom post type suddenly stoped working after WordPress 5 update
  55. copy images from custom field to another custom field
  56. Reusable metabox backend and frontend
  57. Cannot obtain custom meta information
  58. Get custom term meta problem on single post type
  59. Display custom meta on page that has been check in custom post type
  60. Meta box data is saved but NOT displayed in the meta box text field. Why?
  61. How to call a post’s metadata in shortcode.php?
  62. How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?
  63. Save Metabox Custom Field Value
  64. Meta box data not saving
  65. WP_Meta_Query object with conditionals
  66. Related posts meta_query CPT
  67. Meta box with front-end styling
  68. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  69. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  70. Cannot Save MetaBox Data in Custom Post Type
  71. Adding an extra parameter [string] to my posts’ permalink?
  72. delete duplicate meta_value with same post_id
  73. Search CPT Title AND Meta
  74. updating one custom meta field only
  75. Problem On Retrieving Post Meta Data on Custom Column [closed]
  76. Function to return values from metabox
  77. Saving metabox keys and storing values as array
  78. Custom Post Type Meta Box Text Input Field Won’t Save When Blank
  79. Filter search posts by post meta?
  80. Custom Meta Box with variable number of fields
  81. Custom fields for post or terms which don’t update on post update
  82. Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
  83. How to keep custom post type related information
  84. How to avoid duplicate posts queried from custom meta?
  85. Custom Metabox Info Not Saving
  86. How can I add a meta[] to my custom post type and search by term with the Rest API?
  87. Show posts from WP Custom Post Type selected from a field in a metabox
  88. Creating an archive page or simple template to list all values of a custom field of specific post type listing
  89. Where is get_post_meta value located?
  90. PHP Warning with Custom Fields
  91. Custom meta fields not showing up in WP_Response Object via custom endpoint
  92. Problem with multi checkboxes value in metabox?
  93. Get meta values from parent post and save in child post
  94. How to Disable option of meta field if that option is selected for any other post in custom post type?
  95. Simple Data picker meta box
  96. Metaboxes in Loop
  97. Add more custom fields when creating a new custom post type
  98. check_admin_referer not working in custom meta box for custom post type
  99. Custom meta box data not saving
  100. How do I extract the contents of a CPT’s custom field for all posts?
Categories custom-post-types Tags custom-field, custom-post-types, metabox, post-meta, single
wp-config.php file permissions
Multisite Independent User Base

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress