Choosing a default page tempate (Classic => Gutenberg)

This is possible with javascript using the wp.data api.

You can see this work in the console, by replacing the template name as needed:

wp.data.dispatch('core/editor').editPost( {template: "templates/blank.php"} )

You would just need to run that at some point after the editor sidebar components have loaded in a check to see if the page template has been set yet.

Leave a Comment