TinyMCE Visual Blocks plugin set Show blocks option for all users
-
18-04-2021 - |
Pregunta
I want the Show blocks feature of the TinyMCE Visual Blocks Plugin to be activated for all users.
I can activate the Show blocks feature under the View menu dropdown manually. See picture. This activates it for the current user.
How can I activate the feature for all users? Can it be done via the tiny mce before init hook similar to setting visualblocks_default_state ?
https://www.tiny.cloud/docs/plugins/visualblocks/ https://codex.wordpress.org/Plugin_API/Filter_Reference/tiny_mce_before_init
Solución
Just add this code to functions.php
of your theme and then "View" --> "Show blocks" will always be enabled immediately when the page loads
if( !function_exists('custom_settings_tinymce') ){
function custom_settings_tinymce($init) {
$init['visualblocks_default_state'] = true;
return $init;
}
add_filter('tiny_mce_before_init', 'custom_settings_tinymce' );
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a wordpress.stackexchange