Hide WordPress block editor for pages with a specific page template

Recently I had the requirement in a project where I wanted to remove the block editor, only for pages that had a specific page template assigned.

In my case the page template was inside the templates folder of the theme and the filename was page-content.php. This meant the page template had a slug of:

templates/page-content.php

The following code, in my case added to the themes functions.php file meant the editor did not show on pages with that template assigned.

Posted by

Pablo Eduardo Ibáñez López

Facebook
Twitter
LinkedIn