Categories
Technical

🧱Gutenberg: disable / remove completely block editor’s tips

Gutenberg tips are tooltip panels displayed on the block editor’s interface the first time you open it.

Users frequently ask how to disable these tips. First method: go to editor’s options and uncheck “Tips” checkbox. The issue is that like many settings of the editor, these settings are saved on the user’s browser using LocalStorage. That way, the tips will come back everytime you’re using a different device to access the editor. It’s also necessary to use that method individually for each administrator of the website.

🧨How to get totally rid of Gutenberg tips in the WordPress block editor

You just have to go to your theme (or your child theme) functions.php file and add the following snippet:

function jba_remove_gutenberg_tips() {
	$script = "
jQuery(document).ready(function(){
    var is_tip_visible = wp.data.select( 'core/nux' ).areTipsEnabled()
    if (is_tip_visible) {
        wp.data.dispatch( 'core/nux' ).disableTips();
    }
});	
	";
	wp_add_inline_script( 'wp-blocks', $script );
}
add_action( 'enqueue_block_editor_assets', 'jba_remove_gutenberg_tips' );

This snippet will implement a tiny 5-lines JS script to ask the editor to simply check by default the remove tips option in Gutenberg !

Et voilà! 🇫🇷😎

Leave a Reply

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