How to remove Custom Field section from Wordpress?

Moon picture Moon · May 6, 2010 · Viewed 15.7k times · Source

I am trying to remove custom fields section from Wordpress backend. I think I found a function that display custom fields. The function is located in wp-admin/edit-page-form.php line 181.

do_meta_boxes('page','normal',$post)

when I remove the function, Wordpress does not display other boxes as well.

How do I remove a particular box from Wordpress backend?

Answer

Daniel Sachs picture Daniel Sachs · Nov 5, 2010
function remove_metaboxes() {
 remove_meta_box( 'postcustom' , 'page' , 'normal' ); //removes custom fields for page
 remove_meta_box( 'commentstatusdiv' , 'page' , 'normal' ); //removes comments status for page
 remove_meta_box( 'commentsdiv' , 'page' , 'normal' ); //removes comments for page
 remove_meta_box( 'authordiv' , 'page' , 'normal' ); //removes author for page
}
add_action( 'admin_menu' , 'remove_metaboxes' );

change "page" to "post" to do this for posts

Put this in your function.php file