Override Rich Edit Setting

It’s very easy to override the user-selected rich edit setting. Whether they’ve selected to show it or hide it, it can be reversed in a single line of code:

Always show:

add_filter( 'user_can_richedit', '__return_true' );

Always hide:

add_filter( 'user_can_richedit', '__return_false' );

Of course, if you’re going to overwrite this setting, it would make sense to also hide the user’s checkbox for this option.

add_action( 'admin_print_styles-profile.php', 'hide_rich_edit_option' );
add_action( 'admin_print_styles-user-edit.php', 'hide_rich_edit_option' );
function hide_rich_edit_option() {
    ?><style type="text/css">
    label[for=rich_editing] input { display: none; }
    label[for=rich_editing]:before { content: 'This option has been disabled (Formerly: ' }
    label[for=rich_editing]:after { content: ')'; }
    </style><?php
}

You can probably remove it more fully with Javascript, but I’ll leave that up to you.

One thought on “Override Rich Edit Setting”

  1. gulliver

    I’m reluctant to comment on such an old post but…

    Thanks – it’s genuinely useful.

    Is there a way to further modify things so that the default text of ‘Disable the visual editor when writing’ doesn’t appear.

Leave a Reply

Your email address will not be published. Required fields are marked *