How to remove custom field section from Wordpress?

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

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

when I remove this function, Wordpress also does not display other fields.

How to remove a specific field from a Wordpress backend?

+6
wordpress custom-fields
source share
4 answers

You change the main files, which is not very good when it comes to updates and end users. Go to “Screen Settings” and cancel “Custom Fields” or use the http://wordpress.org/extend/plugins/custom-write-panel/ plugin to hide the editor panels. Or, check the plugin for the code that you need to disable each editor option, without using the plugin.

+5
source share
 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 the "page" to "post" to do this for posts

Put this in function.php file

+18
source share

Here's how to do it for all types of messages:

 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 ); } 
+5
source share

You can easily do this by editing the CSS for a separate window inside the admin. The first method that comes to mind is to add the following to your theme functions.php file.

 <?php add_action('wp_head','hide_custom_fields_postbox'); function hide_custom_fields_postbox() { if ( is_admin() ) { ?> <style type="text/css"> div#postcustom {display:none;} </style> <?php } }//end function ?> 
0
source share

All Articles