How to enable Gutenberg Block Editor on taxonomy term pages?

I have a custom taxonomy, which has URLs like this: /destination/usa/hawaii/

What I would like to achieve is to enable Gutenberg on URLs like that. That would mean, that an administrator could edit the URL and put blocks just how he would on normal posts and pages.

WordPress is only giving me an option to add description to the taxonomy term like with the Classic Editor. But this is not powerful enough for me. I would like to add some of my blocks.

How can I achieve this?

What I have tried:

I tried creating a page with permalink /destination/ and another subpage with permalink /usa/ so that it ends up having the same URL /destination/usa/ as my taxonomy Term. I was hoping that WordPress will detect my page first and display that one because on normal pages in WordPress I have the Gutenberg Block editor. But WP still displays the Term, not the Page with the same permalink.

Another idea I had is basically creating set of pages with the same link structure: /pages/usa/hawaii/, set them to noindex and out of the sitemap and then use .htaccess to rewrite:
/destination/* => /pages/*
But this seems very hacky and also can lead to confusion.

1 Answer
1

As mentioned in the comments, it isn’t currently supported, although there is an open issue for exactly this feature: https://github.com/WordPress/gutenberg/issues/17099

Meanwhile, I can think of a couple of ways to achieve the same effect:

1) Pages + custom rewrites

As you suggested in your question, you could create a set of parallel pages with the same slugs as your custom taxonomy terms. You can then either:

  • Change your theme’s custom taxonomy template to pull the data from pages with the same slug, or
  • Add rewrite rules to redirect term urls to pages with the same slug, using built-in wordpress functions rather than the .htaccess (see https://developer.wordpress.org/apis/handbook/rewrite/)

2) Standalone block editor + custom logic

It is possible to create standalone instances of the block editor. Once you’ve achieved that, you would have to develop custom logic to:

  • link the data saved by a standalone instance to a custom taxonomy term, and
  • pull that data from your theme’s custom taxonomy template

Here is the explainer on creating standalone block editors:
https://developer.wordpress.org/block-editor/how-to-guides/platform/custom-block-editor/tutorial/

Leave a Comment