Guide to Removing the Featured Image Meta Box in WordPress

Home » Snippets » Guide to Removing the Featured Image Meta Box in WordPress

Created with:



Creator: WPTurbo Team

Customize with WPTurbo AI

Add Snippet To Project

New Project
Add To Existing Project

The featured image meta box is generally a fundamental part of WordPress. However, for a variety of reasons, you may find that you need to remove this feature from your site. Perhaps you’re not using this feature, or you might want to simplify the backstage area of your site to lessen confusion for certain types of users. No matter the reason, this guide will show you how to effectively remove the featured image meta box from your WordPress site.

					function wpturbo_remove_featured_image_meta_box() {
    remove_meta_box('postimagediv', 'post', 'side');
add_action('do_meta_boxes', 'wpturbo_remove_featured_image_meta_box');

The purpose of this code is to remove the "Featured Image" meta box from the WordPress dashboard for posts.

The first part of the code defines a new function called wpturbo_remove_featured_image_meta_box(). This is the function that will be called to remove the meta box.

Within the function body:

remove_meta_box('postimagediv', 'post', 'side');

The function remove_meta_box is called, which is a built-in WordPress function specifically designed to remove meta boxes. This function requires three parameters.

1) postimagediv: This is the ID of the meta box you want to remove. Each meta box in WordPress has a unique ID. In this case, ‘postimagediv’ is the ID of the "Featured Image" meta box.

2) post: This specifies the screen or post type from which the meta box will be removed. Here ‘post’ indicates we’re removing this from "Post" screens. If you’d like to remove the same meta box from "Pages", you’d replace ‘post’ with ‘page’.

3) side: This is the context where the boxes are located. In the case of the "Featured Image", it’s usually located in the ‘side’ context. Other possible values are ‘normal’ and ‘advanced’.

Subsequently, the wpturbo_remove_featured_image_meta_box() function is hooked into the ‘do_meta_boxes’ action.

add_action('do_meta_boxes', 'wpturbo_remove_featured_image_meta_box');

‘do_meta_boxes’ is a WordPress hook that fires after all meta boxes have been added. By hooking into this action, we make sure that our function is not called until after the "Featured Image" meta box has been added, ensuring that we can successfully remove it.

Register an account to save your snippets or go Pro to get more features.