Forums

Move 'Set Featured Image' inside another Metabox (2 posts)

  1. TheBishopsBane
    Member
    Posted 9 months ago #

    Hello,

    Essentially what I'm looking to do is disable the default "Set Featured Image" metabox, but have the same code appear inside a different metabox, along with some custom meta fields. I've found lots of great support on enabling thumbnail support and adding custom metaboxes, but I haven't seen anyone with this issue. I know that it's not really changing much for the user, but it's important for the plugin I'm writing to have the featured image be immediately associated with some other meta fields.

    Any help is much appreciated.

  2. kdoole
    Member
    Posted 1 month ago #

    This works for me (inside functions.php):

    add_action( 'do_meta_boxes', 'move_image_box' );
    function move_image_box() {
    	remove_meta_box( 'postimagediv', '[your_post_type]', 'side' );
    	add_meta_box( 'postimagediv', __( 'Featured image' ), 'post_thumbnail_meta_box', '[your_post_type]', 'normal', 'high' );
    }

    See docs for add_meta_box for details on how to control where you place the meta box.

Reply

You must log in to post.

About this Topic