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

How to add multiple featured image in meta box in post editor?

I know you said you were looking for your own implementation, but the easiest way to add multiple featured image metaboxes is with the Multiple Post Thumbnail plugin.

Following the plugin’s documentation, the way to define a secondary box is to add this code to your theme’s functions.php

   if (class_exists('MultiPostThumbnails')) {
        new MultiPostThumbnails(
            array(
                'label' => 'Secondary Image',
                'id' => 'secondary-image',
                'post_type' => 'post'
            )
        );
    }

and then to display the image in your theme somewhere:

if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image'); endif;

Related Posts:

  1. Using add_theme_support inside a plugin
  2. How to add multiple images to custom post type?
  3. How do I remove all the metaboxes for a custom post type?
  4. Get all posts from custom post type and insert in select input as metabox
  5. Detect meta value changes when post is updated (post_updated)
  6. WordPress metabox file upload in custom post [duplicate]
  7. Having trouble with custom post type / meta box
  8. How can I include meta box content when searching?
  9. Save or update data when custom post published
  10. update a post meta from a single table cell TablePress
  11. update custom post type meta from a shortcode
  12. Custom Meta Boxes – Nonce Issue – Move to trash issue
  13. Displaying Meta Box Image
  14. How to: add option to add more checkboxes on custom post type
  15. How to keep a check box in custom meta box for custom post type checked by default for add new post?
  16. Show metabox in custom-post-template depending on taxonomy term?
  17. how to set default value for checkbox in wordpress
  18. Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
  19. Displaying custom posts only if custom meta box’s date is not expired
  20. Displaying Metabox value (custom post type taxonomy)
  21. How to List Thumbnails based on Custom Categories
  22. Adding Meta Boxes while Registering a Post Type in a Class
  23. How can I display my custom metaboxes on a custom post template?
  24. Meta Box Only in CPT Edit Page, Not in Add New
  25. get_post_meta is returning image id
  26. need advice on how to do a lists using custom post types – taxonomy vs postmeta
  27. Metadata for a taxonomy – is there any WordPress way of doing this?
  28. Populate Custom Fields in a Custom Post Type?
  29. Insert Multiple Post with Same Publish Button
  30. Custom meta box data array: foreach not working correctly?
  31. Undefined Variable – Custom Post Type Meta
  32. Populate dropdown from one custom post type inside another custom post type
  33. How to check if user meta field is empty in conditional else statement
  34. How to set YouTube video as featured image?
  35. Getting meta in editor plugin, and event triggering issue
  36. A better way to add a meta box to custom post types
  37. Metabox not show in categories custom post type cmb2
  38. How to use TinyMCE Editor for one of my custom post meta field?
  39. Show Custom Post Type meta boxes only on Page Edit
  40. Adding a metabox on a CPT’s submenu page
  41. Wrap meta boxes & data handling for specific post types in classes?
  42. Can’t publish custom post type – “You are not allowed to edit this post.”
  43. Custom fields for custom post type
  44. Meta Data for Custom Post Type not saving
  45. Save Multiple Metabox values
  46. create custom meta box with default value
  47. Displaying a div from an assigned meta_value when on a page
  48. How to Echo Metadata Value in Currency Format
  49. Issue on Working with Metabox – Checkbox to enable Sale Items
  50. Why do I have to press the “Update” button twice to save my meta box values?
  51. How to insert data into meta box from another plugin?
  52. Custom Meta Box returns no HTML
  53. Custom post type suddenly stoped working after WordPress 5 update
  54. How to Use Custom Meta Field Instead of CPT Title in Post URL
  55. link featured image to external link
  56. Problem with adding custom post type meta to header by plugin
  57. Creating alternate meta box context locations
  58. Is it possible to sort metabox teaxtarea values?
  59. Create a select metabox that the user can pupolate?
  60. How can I output WPAlchemy repeating fields meta values in my page template?
  61. Meta box data is saved but NOT displayed in the meta box text field. Why?
  62. Save Metabox Custom Field Value
  63. Meta box data not saving
  64. WP_Meta_Query object with conditionals
  65. Related posts meta_query CPT
  66. Meta box with front-end styling
  67. Sanitaizing Select Optin For Custom Post Type Metabox in WP
  68. How to retrive Custom Post Type Meta Fields in Custom WP_Query
  69. Cannot Save MetaBox Data in Custom Post Type
  70. Add a class to post_class if more than one post shares same meta_value_num
  71. Function to return values from metabox
  72. Add a meta field to the list of results for a custom post type
  73. Empty meta-box returns publishdate if no value is set?
  74. Custom Meta Box with variable number of fields
  75. Wp Meta Query does not work while simple Query Works
  76. Custom Post Type meta data getting deleted on bulk editing taxonomies
  77. How to add a default predefined thumbnail when creating a brand new post?
  78. Show a custom post title in another custom post type in Meta box
  79. Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
  80. WP_List_Table Inside Metabox Not Working on Clicking Search Button
  81. Getting data from dynamically allocated metaboxes within a custom post
  82. Get meta values from parent post and save in child post
  83. Admin metabox with custom post type dropdown option not update choosed input after saving
  84. Metaboxes in Loop
  85. How save custom meta type posts multicheck grouped by taxonomy (with CMB2) [closed]
  86. php output of generated custom metabox
  87. Custom meta box data not saving
  88. Collect custom post in a calendar
  89. Custom meta box in editor of custom post type not working
  90. Delete custom post type metadata without deleting the post in admin area
  91. Problem with ‘save_post’ hook not running
  92. Edit post meta direct from post.php?
  93. Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
  94. Howto: use existing post_meta as options for a different metabox (checkboxes or list)
  95. Display a post count from a custom metabox selection
  96. Customized featured image doesn’t refresh in post admin metabox after upload/insert
  97. Post AND page parameter for WP function
  98. Use a Variable in update_post_meta as the $meta_key
  99. How to consume external API from WordPress post editor and display the response data in the custom field?
  100. I am having a problem with fetching product data in the Gutenberg block editor
Categories custom-post-types Tags custom-post-types, metabox, plugin-development, post-meta, post-thumbnails
Constructing a custom login form using ajax
How to remove RSS feeds from WordPress theme

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