Detecting per-post use of Gutenberg

There may be times when you need to detect use of Gutenberg on a per-post level – for example, a plugin that adds specific Gutenberg functionality, or maybe to display specific content on Gutenberg pages.

With plugins such as Gutenberg Ramp available, making it easy to specify specific groups of posts that should use Gutenberg, plus the fact that only posts you edit/add after installing Gutenberg will make use of its new functionality, it’s easy to see that most sites will end up with a mixed estate.

The following simple function will add a simple is_gutenberg() function that you can call to check the status of the current post (I leave it to you to check for whether it’s a single post, etc).  It returns either a true or false result.

Posted by David Artiss

Enterprise Happiness Engineer for the WordPress VIP team at Automattic. Gamer, film lover and general fan of all things Marvel, Star Trek and Star Wars. Failed comedian. Writer for The Big Tech Question. World's Greatest Grandma.

Talk to me!

This site uses Akismet to reduce spam. Learn how your comment data is processed.