How should I completely disable the visual and html editor from pages? I know I can disable the visual editor in my profile, but I am trying to lock down the content input areas so that my client doesn't muck things up.
-
I would be interested in learning why you'd lock the content and not educate your client? After all idea with WordPress site is that client is able to update their content.– Azizur RahmanJun 26, 2011 at 22:53
-
2Everything is split into custom meta boxes, so really the editor is just getting in the way. Everything is in meta boxes to keep a decent structure to the page. Really it's not worth going into here, but trust me this is the best way for this particular site.– TomJun 26, 2011 at 23:23
2 Answers
Why not use custom post types and don't add any support for the editor, that is afterall what they are for and the easiest way . The answer in this post covers how to do that,
Hide content box with Custom Post Type?
http://codex.wordpress.org/Function_Reference/register_post_type
To remove that functionality for pages or posts (and custom types) you can try and use remove_post_type_support
. For pages;
add_action('init', 'my_remove_editor_from_post_type');
function my_remove_editor_from_post_type() {
remove_post_type_support( 'page', 'editor' );
}
Ref: http://codex.wordpress.org/Function_Reference/remove_post_type_support
A hacky solution is to use CSS display:none;
for the #editorcontainer
or one of the sub id or classes. You can also then enqueue that style only for particular users.
Think this might be what your looking for, code and more info from wpsnipp:
add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
add_action( 'admin_head', 'disable_html_editor_wps' );
function disable_html_editor_wps() {
global $current_user;
get_currentuserinfo();
if ($current_user_can('manage_options') {
echo '<style type="text/css">#editor-toolbar #edButtonHTML, #quicktags {display: none;}</style>';
}
}
i've altered it from using user levels to using if ($current_user_can('manage_options') {
so this should remove it for everybody but admin, code needs to gi in your themes functions.php
-
1Why not simply take
current_user_can( 'manage_options' );
? Jes, there's a function for each & everything ;)– kaiserJun 26, 2011 at 22:50