WordPress.org

Ready to get started?Download WordPress

Forums

Drag & Drop Featured Image
[resolved] Featured Image Won't Disappear When Function is Set to (6 posts)

  1. Adam
    Member
    Posted 1 year ago #

    In my functions.php file, I have added theme support for post thumbnails:

    if(function_exists('add_theme_support')) {
    	add_theme_support( 'post-thumbnails' );
    }

    I have added another function to remove the Featured Image box from specified post types (e.g. Page, Post, or a Custom Post Type).

    function remove_image_box() {
    	remove_meta_box( 'postimagediv','page','side' );
    	remove_meta_box( 'postimagediv','news','side' ); // custom post type
    }
    add_action('do_meta_boxes', 'remove_image_box');

    This works well when the D&D plugin is NOT enabled, but once it is enabled, the D&D Featured Image box appears with all post types, regardless of the removal function.

    Is there a way to fix this, or a better function I could use to remove the Featured Image box for specific post types?

    http://wordpress.org/extend/plugins/drag-drop-featured-image/

  2. Jonathan Lundström
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Adam!

    My plugin automatically adds post thumbnail support for activated post types and removes the default meta box replacing it with the one from my plugin. Therefore you should not have to worry about enabling the theme support yourself.

    If this is an issue let me know, and I'll try to create a solution.

    Best regards,
    Jonathan

  3. Adam
    Member
    Posted 1 year ago #

    My plugin automatically adds post thumbnail support for activated post types and removes the default meta box replacing it with the one from my plugin.

    Does this mean that instead of disabling the WP meta boxes, I should be targeting the meta box from your plugin? If so, how do I go about doing this? Thanks!

  4. Jonathan Lundström
    Member
    Plugin Author

    Posted 1 year ago #

    Hello again!

    This is how the plugin works:
    It activates theme support for post thumbnails and loops through the post types that you have enabled. Then it adds post type support for a featured image for all of those post types and removes the default "Featured Image" meta box.

    So, if you have a post type where you have not applied my plugin to, you should be able to remove the box in the normal manner by using this code:

    remove_post_type_support('POST_TYPE', 'thumbnail');
    remove_meta_box('postimagediv', 'POST_TYPE', 'side');
    remove_meta_box('postimagediv', 'POST_TYPE', 'normal');
    remove_meta_box('postimagediv', 'POST_TYPE', 'advanced');

    Let me know if you still experience problems and I will try my best to fix this.

  5. Jonathan Lundström
    Member
    Plugin Author

    Posted 1 year ago #

    Since nothing more has happened in this thread I'm taking the liberty of marking this issue as resolved. Please do notify me if you have any additional problems.

  6. Adam
    Member
    Posted 1 year ago #

    Thanks, Jonathan. Everything's working fine!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic