Remove the main editor from the wordpress edit page screen

Does anyone know how to remove the main editor from the page edit page? And not only with css. I added a few other meta boxes with tinim, and they encounter the main one.

I have a class that removes other meta windows from the editing screen, but I cannot get rid of the main editor this way. I tried adding "divpostrich" and "divpost" to the array in the class (but no luck):

class removeMetas{ public function __construct(){ add_action('do_meta_boxes', array($this, 'removeMetaBoxes'), 10, 3); } public function removeMetaBoxes($type, $context, $post){ /** * usages * remove_meta_box($id, $page, $context) * add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') */ $boxes = array( 'slugdiv', 'postexcerpt', 'passworddiv', 'categorydiv', 'tagsdiv', 'trackbacksdiv', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'postcustom'); foreach ($boxes as $box){ foreach (array('link', 'post', 'page') as $page){ foreach (array('normal', 'advanced', 'side') as $context){ remove_meta_box($box, $type, $context); } } } } } $removeMetas = new removeMetas(); 

I also tried removing 'divpostrich' using jquery. But I can’t understand where to put js for its work. When I delete "postdivrich" in the browser using firebug - my remaining tinymce fields work fine.

Any ideas?

+6
jquery php wordpress wordpress-theming
source share
5 answers

What you are looking for is a $_wp_post_type_features global array.

Below is a brief example of how to use it.

 function reset_editor() { global $_wp_post_type_features; $post_type="page"; $feature = "editor"; if ( !isset($_wp_post_type_features[$post_type]) ) { } elseif ( isset($_wp_post_type_features[$post_type][$feature]) ) unset($_wp_post_type_features[$post_type][$feature]); } add_action("init","reset_editor"); 
+8
source share

There is built-in support for WP for this, so you don’t need to hide directly with the global ones and provide backward compatibility if they ever change the way they handle functions. WP Core code follows pretty much the same logic as @ user622018, however

 function remove_editor() { remove_post_type_support('page', 'editor'); } add_action('admin_init', 'remove_editor'); 
+24
source share

Add the following code to your functions.

 function remove_editor_init() { if ( is_admin() ) { $post_id = 0; if(isset($_GET['post'])) $post_id = $_GET['post']; $template_file = get_post_meta($post_id, '_wp_page_template', TRUE); if ($template_file == 'page-home.php') { remove_post_type_support('page', 'editor'); } } } add_action( 'init', 'remove_editor_init' ); 
+2
source share

Could you just turn off the TinyMCE editor, leaving the HTML editor as your meta fields collide with it? :)

0
source share

To disable the editor, you need to edit the wp-config.php and add this line to the top of the page:

 define('DISALLOW_FILE_EDIT', true); 
0
source share

All Articles