How to Remove the Author Post Metabox in WordPress

Home » Snippets » How to Remove the Author Post Metabox in WordPress
0

Created with:

Visibility: 

public

Creator: WPTurbo Team

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project

Does the author post metabox on your WordPress dashboard appear cluttered or redundant to you? Are you looking to have a more streamlined and efficient WordPress interface? If yes, then this article is for you. Dive in as we guide you step by step on how to efficiently remove the author post metabox from your WordPress dashboard to enhance your overall user experience.

					function wpturbo_remove_author_metabox() {
    remove_meta_box('authordiv', 'post', 'normal');
}
add_action('admin_menu', 'wpturbo_remove_author_metabox');
				

The code snippet begins by defining a new function called wpturbo_remove_author_metabox(). As the name suggests, this function’s role is to remove the author metabox from the WordPress post edit screen.

function wpturbo_remove_author_metabox() {
    remove_meta_box('authordiv', 'post', 'normal');
}

We use the built-in WordPress function remove_meta_box() to accomplish this. remove_meta_box() requires three parameters:

  1. id – The CSS ID of the metabox ("authordiv" for the author metabox).
  2. screen – The screen or screens on which the metabox is being shown (like ‘post’, ‘page’, ‘dashboard’, ‘link’, ‘attachment’, ‘custom_post_type_slug’, etc.)
  3. context – The area of the page where the metabox is supposed to be shown (like ‘normal’, ‘advanced’, or ‘side’).

In this case, remove_meta_box('authordiv', 'post', 'normal'); essentially means we’re removing the "authordiv" metabox (which is the ID for the Author metabox in WordPress), from the ‘post’ screen, in the ‘normal’ context.

Finally, to ensure that our wpturbo_remove_author_metabox() function is executed, we hook it into the admin_menu action.

add_action('admin_menu', 'wpturbo_remove_author_metabox');

The add_action() function is another built-in WordPress function that hooks a function to a specific action. So, when the admin_menu action is triggered, the wpturbo_remove_author_metabox() function is executed.

The end result is that the Author metabox is removed from the Post Edit screen in the WordPress admin dashboard.

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