Archived topic
Gutenberg (block) editor for category
7 replies · Started by Vijay on December 27, 2019
I am loving the flexibility of the block editor with the layout capabilities of GeneratePress.
However, category description is using the Classic Editor.

Wondering if it is possible to enable the block editor for such category pages as well?
Hi there,
This isn't the theme can do as it's handled by WordPress.
Looks like someone already mentioned it to WordPress:
https://github.com/WordPress/gutenberg/issues/12511
How you get to show the Classic Editor in the category description?
I think you will need some kind of plugin to give the flexibility to edit category descriptions :)
Hi there,
There's actually a way to use Block Element and its contents as for the category description but it has its drawbacks.
First, we can allow shortcodes to run on category description field.
We can do that by adding these PHP snippets:
add_filter( 'term_description', 'shortcode_unautop' );
add_filter( 'term_description', 'do_shortcode' );
remove_filter( 'pre_term_description', 'wp_filter_kses' );
We then create a shortcode to allow us to create portable hooks anywhere it's placed.
add_shortcode('portable_hook', function($atts){
ob_start();
$atts = shortcode_atts( array(
'hook_name' => 'no foo'
), $atts, 'portable_hook' );
do_action($atts['hook_name']);
return ob_get_clean();
});
Usage: [portable_hook hook_name="my_custom_hook"]
You can use this shortcode on a category description as shown here:
https://share.getcloudapp.com/12uoW914
Now we can create a Block element we can hook into my_custom_hook.
Here's an example: https://share.getcloudapp.com/nOuljEN2
After saving, the block element should appear as the category description.
With this, you can name the hooks unique for each category. You can also make a block element for each category description. :D
I understand that this seems pretty advances and it has its drawbacks(you have to create multiple block elements) but if you want to use Gutenberg for the category description, this could work.
@Vijay
Classic editor is default for Post Categories and Tags.
Sorry, but in your first image there is an editor, and in the second one no.
By default, worpress dont show any editor in the category description. Maybe you installed a plugin?
[url=https://ibb.co/Tgr8rcY][img]https://i.ibb.co/tJ3s3BQ/Captura-de-pantalla-2021-03-16-145924.png[/img][/url]
This is the plugin to allow editing category description using the Classic Editor
https://pe.wordpress.org/plugins/categorytinymce/
I'm not sure if it works with current versions.
I will be much happier when WP adds block editor functionality!
MIK
