If every time you open the WordPress Gutenberg Editor you see a “Welcome to the block editor” popup you have probably become annoyed like me. I don’t understand why WordPress displays this notice every time you edit a post in Gutenberg regardless of how many times you close it. There is a track ticket open for this issue but it doesn’t have any traction.
Don’t worry though, I’m here to save the day. I will show you how to finally & permanently remove the “Welcome to the block editor” popup from your site!
In these guides I focus on providing code based solutions. If you are looking to disable the popup without code then you can try this plugin instead.
Because of how Gutenberg works, the popup can’t be removed using just PHP code. In other words, there isn’t a filter you can easily hook into and disable the “feature”. You will need to use PHP to insert a javascript into the admin.
Code Snippet
Below is the code snippet I personally use on this site to remove the unwanted welcome popup notice whenever I go to add or edit a post.
/**
* Disable the "Disable Welcome Messages" in the Gutenberg Editor.
*
* @see https://www.wpexplorer.com/disable-welcome-to-the-block-editor/
*/
function disable_editor_welcome_message() {
?>
<script>
window.onload = (event) => {
wp.data && wp.data.select( 'core/edit-post' ).isFeatureActive( 'welcomeGuide' ) && wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'welcomeGuide' );
};
</script>
<?php
}
add_action( 'admin_head-post.php', 'disable_editor_welcome_message' );
add_action( 'admin_head-post-new.php', 'disable_editor_welcome_message' );
add_action( 'admin_head-edit.php', 'disable_editor_welcome_message' );
I won’t go into all the details explaining why and how this code works as that would take way too long. But I do want you to see how I’ve hooked into the core admin_head-{$hook_suffix}
to ensure our code only gets added when needed.
When writing the code for my own site I did a little research to see how other people were doing it and noticed so many guides recommended just hooking into admin_head
, but I hate adding extra code when not needed and always optimize my code so it runs only when necessary.
If you really wanted to, you could also add an check around the whole code using is_admin() so that the code isn’t even available on the frontend. Personally, when working with a theme or plugin I like to keep my admin code separate from my frontend code in different files. Using a check like this:
if ( ! is_admin() || wp_doing_ajax() ) {
// load frontend files
} else {
// load admin files
}
Creating Your Own Plugin to Remove the Block Editor Welcome Message
If you are going to use this same code across many sites you may want to create a little plugin instead to install anywhere you need it. Plus, if WordPress ever removes this in the future you can just delete the plugin once it’s no longer needed.
Creating WordPress plugins is very easy and as long as you aren’t going to upload your plugin to WordPress.org there are very little requirements. All you really need is a folder with a single PHP file inside it.
This article isn’t intended to show you how to create a WordPress plugin so I took the liberty to create one for you that you can use. This plugin is not hosted on WordPress.org so you don’t have to worry about updating it and you can rename it to anything you want.
The code in the plugin is the same as the code above but with an added Plugin Header so that it’s recognized as a plugin and can be installed and activated.
Check out the plugin on Github.