While working on a client project I needed to disable plugin shortcode button from visual editor in WordPress that were added automatically after some plugin installation. I was trying to hide WP Socializer plugin shortcode button form visual editor. Here I’m explaining how did I do that. The solution is quite simple.
Disable plugin shortcode button from visual editor
First of all you have to find the plugin which you want to remove the button and I hope you already know targeted plugin if you wish to hide or disable button for it. Next part is to find the line among plugin files:
if ( get_user_option(‘rich_editing’) == ‘true’) :
and change the word ‘true‘ with ‘false‘
if ( get_user_option(‘rich_editing’) == ‘false’) :
This line can be found mainly in plugin’s main file or a file named ‘shortcode’ with it. To find the line you can either copy file’s content in your favourite text editor then search and replace as specified or use WordPress’s inbuilt plugin editor under dashboard.
If you are unable to find the line then you can also try the same process with finding word somewhat like this below and commenting later in plugin files:
1 | add_filter('mce_buttons', 'wpsr_register_wpsrbutton_tinymce'); |
I have places code from WP Socializer plugin as an example. Try to find ‘mce_button‘ and comment out the whole ‘add_filter‘ line in your target plugin’s file to remove plugin shortcode button from visual editor.