I like Gutenberg a lot, however, the tips at the beginning of each page load
drives me mad. I would like to disable the nagging tips forever and ever via code.

Please don’t post “Disable Gutenberg” plugin, I’ve already seen that. I want to do it via a couple of lines of code in my theme.

There must be a hook, but I couldn’t find it.
Thanks for a hint.

enter image description here

3 s
3

enter image description here

Update #1:

After asking from @leymannx I checked how these settings are stored.
It turned out that settings are not permanent, they are saved in the browser as localStorage.

key: WP_DATA_USER_{id}:
value: {
    "core/nux":{
        "preferences":{
            "areTipsEnabled":false,
            "dismissedTips":{}
        }
    },
    //"core/edit-post"
    //...

Update #2:

Gutenberg tips can be disabled by using dispatch('core/nux').disableTips() (NUX package) and action hook enqueue_block_editor_assets.

file functions.php:

function se334561_editor_tips() {

    wp_enqueue_script(
        'se334561-js',
        // --- to use in plugin ---
        // plugins_url('/disable-tips.js', __FILE__),
        get_stylesheet_directory_uri() . '/disable-tips.js',
        array('wp-blocks')
    );
}
add_action('enqueue_block_editor_assets', 'se334561_editor_tips');

file disable-tips.js:

jQuery(document).ready(function(){
    var isVisible = wp.data.select('core/nux').areTipsEnabled()
    if (isVisible) {
        wp.data.dispatch('core/nux').disableTips();
    }
});

Tags:

Leave a Reply

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