Remove/Disable Visual Editor Mode in WordPress for Users

There are few methods to remove or disable Visual Editor mode base on users in your WordPress website. If you like to provide only the text editor option to the particular users, then the following code will help you to disable the WYSIWG editor option.
Disable Visual Editor Mode for Particular User Role
The following code will help you to disable Visual Editor based on the user roles. By using a simple function in your functions.php, we going to remove the WYSIWG editor option.
1 2 3 4 |
$user = wp_get_current_user(); if ( in_array( 'author', (array) $user->roles ) ) { add_filter( 'user_can_richedit' , '__return_false', 50 ); } |
Note: You need to change the user role in the array, Now this will work for the author role. Also you change or add any other user roles like Subscriber, Contributor, Editor, etc..
Disable Visual Editor Mode for All Users
By using the below code in your functions.php you can disable the Visual Editor mode for all user roles.
1 |
add_filter( 'user_can_richedit' , '__return_false', 50 ); |
The above code will disable overall user access from the WYSIWG editor mode.
Disable Visual Editor Mode for Particular User
With Admin Dashboard, we can easily remove the Visual Editor Mode access for the particular user. The following steps will help you to do that.
1. Admin Dashboard -> Users -> All Users.
2. Click on the user edit option.
3. Now click on Visual Editor checkbox and disable the visual editor when writing.
The above option only works for specific users for that every time you need to select and do manually.
Conclusion:
I hope anyone of these methods will help you to disable Visual Editor mode. If you have any doubts about this topic let me know in the comment section and if you like this post share it with your friends.
Disable Visual EditorWithout Pluginwordpress
Mraj
Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts. If you have any questions let me drop an email with the article name to the following email id: [email protected]