Fixing missing categories and tags in WordPress’ block editor

For several months now, I’ve noticed that the Categories and Tags widgets were missing in my WordPress’s post block editor. It was sort of fine because I could work around it by assigning categories and tags through the Quick Edit functionality from the post list, but it was an annoyance.

I had done the usual debugging steps of disabling plugins, changing to the default theme, even reinstalling the core WordPress code, but nothing changed. I had tried searching online for phrases like “wordpress categories and tags missing” but didn’t come up with anything.

Today, I found two clues that led me to investigate this further. First, when I popped open Chrome’s developer tools, I noticed that the AJAX requests were firing nonstop. I was originally wanting to check whether there were errors in any of the requests, but the requests were all returning JSON responses, so there wasn’t any error in the processing aspect.

Second, I installed the Health Check & Troubleshooting plugin. When I ran it, it showed:

The REST API did not behave correctly

The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.

The REST API did not process the context query parameter correctly.

I happened to come across this blog post which suggested adding the following piece of configuration to the nginx configuration.

location ~ ^/wp-json/ {
    rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}

Lo and behold, it solved the problem! I haven’t dug into the details as to what exactly is going on. I’m just posting this in case other people come across this issue since it was not straight forward to find the resolution to this problem.

Related

One thought on “Fixing missing categories and tags in WordPress’ block editor

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.