I would like to add multiple featured image in meta box in post editor area apart from default available featured image.

I have added the meta box but i have no idea on adding the featured image functionality.

function another_image_custom_meta() {
    add_meta_box('another_meta', __('Another Image'), 'another_image_callback', 'another','side');

add_action('add_meta_boxes', 'another_image_custom_meta');

Where another in fourth field is my custom post type.

function another_image_callback($post) {
    wp_nonce_field(basename(__FILE__), 'another_nonce');
    $p_stored_meta = get_post_meta($post->ID);

       Another featured image


Above functions works fine it show the meta box.

How can i add the link with image upload and save it as featured image to the corresponding post. Like default featured image i want the same function here. can anyone help?

  • You want any solution (i.e. plugin) or only info on how to implement it by yourself? Nov 13, 2013 at 11:22
  • Hey check this wordpress.stackexchange.com/a/45864/42701 see if this helps you
    – user42701
    Nov 13, 2013 at 11:22
  • No need any plugin.I already found multi post thumbnail does this.But i can't study the code there.so i want to Implement by myself so that i can learn each thing.If it is a easy learn guide that would be great. Thanks @ Krzysiek Dróżdż
    – sun
    Nov 13, 2013 at 11:25
  • Thanks. I'm looking for own implementation not any plugins @user42701
    – sun
    Nov 13, 2013 at 11:28
  • I'm new to coding so i lack in understanding and reading code.That is why asking help here. Thanks @helgatheviking
    – sun
    Nov 13, 2013 at 12:09

1 Answer 1


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(
                '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;
  • 1
    Thanks for your time +1. I don't want to use another plugin.Need default WordPress way:)
    – sun
    Nov 13, 2013 at 12:29
  • 4
    To learn how to do it yourself is one thing, but not using a plugin, just to "not use a plugin" is silly. There's nothing wrong with using plugins to simplify our lives. If by "the default WordPress way" you mean add and save metabox data, that is exactly what the plugin does. Nov 13, 2013 at 12:34
  • Plenty of WordPress plugins are messy; I completely agree with OP wanting to learn how to do it, and avoid bloated plugins.
    – bozdoz
    Jun 24, 2016 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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