How to remove Custom Field section from Wordpress? How to remove Custom Field section from Wordpress? wordpress wordpress

How to remove Custom Field section from Wordpress?


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


You're changing core files, which is not good idea when it comes to upgrades and the end-user. Go to "Screen Options" and untick "Custom Fields," or use a plugin http://wordpress.org/extend/plugins/custom-write-panel/ to hide editor panels. Or, check the plugin for the code you need to disable each editor option without using the plugin.


This is how to do it for all post types:

add_action( 'do_meta_boxes', 'remove_default_custom_fields_meta_box', 1, 3 );function remove_default_custom_fields_meta_box( $post_type, $context, $post ) {    remove_meta_box( 'postcustom', $post_type, $context );}