Custom taxonomy not showing up in the Gutenberg post editor?

April 2, 2020

This is just one of those things I keep on forgetting. Almost every single time. When creating a custom taxonomy in WordPress it won’t show up in the Gutenberg editor unless you’ve activated REST support for the taxonomy. That’s because the editor uses the WP REST API. And therefore, the taxonomy has to be exposed through the API for it to be available.

When registering the taxonomy, just use / enable the flag show_in_rest.

function registerMyTopics() {
    $args = [
        'show_in_rest' => true, // expose taxonomy in the REST API
        // [...], All other arguments
    ];

    register_taxonomy('topics', ['post'], $args);
}

add_action('init', 'registerMyTopics', 30);

Once enabled, the taxonomy should show up in the right sidebar.

Tags