0

I created a custom post type outside the wordpress loop. I want to integrate the featured image meta box in the backend for this post type.

$this->add_meta_box('postimagediv','Beitragsbild', array($this, 'featured_image_meta_box'), 'side'); 

which calls the wordpress core function:

protected function add_meta_box($id, $title, $callback, $context = 'normal', $priority = 'default', $callback_args = null ) {
        add_meta_box( 'product_db_' . Kickoff::$action . '_' . $id, $title, $callback, null, $context, $priority, $callback_args);
    }

the meta box works, but if i click on add image, it opens an iframe which calls media-upload.php but i want it to look like the normal wordpress mediagalery function like on create posts. This iframe calls the admin-ajax.php.

Does anyone have any idea what i have to change/call in addition to make the iframe work with the default ajax mediagalery?

0

Instead of manually adding a metabox, just add supports when you register the post type. (Since it is already registered, you may need to unregister_post_type() and then re-register it to make this change.)

For details - How come Featured Image isn't showing up in my Custom Post Type?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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