Despite the tremendous success of the Gutenberg editor, it hasn’t been extended to the category and tag pages. As a result, the category pages are boring, anemic, and are little more than a glorified list. I tried for a long while to see if I could force WordPress to load a new page instead of a category using the same URL as the existing category page. And I finally found a way to do it! So here it is.
A Flexible Solution in Case things Change
I could have just used an easy solution by redirecting my category pages to a new page via a 301 redirect. But while this is easy, it’s also shortsighted. One day, WordPress will bring the Gutenberg editor to categories and tags, and when that happens, I want to just copy/paste my page content into the category or page editor and move on with life.
Using a redirect means our URLs will change when this happens. So let’s see how to do it.
Setting the Rules – What I Want to Achieve
Right now, my category archive page looks like this:
https://nameheroreview.com/blog/category/webhosting
https://nameheroreview.com/blog/category/anothercategory
I want each of these URLs to load a page of my choosing. A page that I can edit using Gutenberg. I don’t want any existing URLs to change, and I don’t want my breadcrumb URLs to be affected.
Step 1: Create a Dummy Parent Page with the slug “category”
The first step is to create a top-level page with a slug called “category”. This page is a dummy and doesn’t do anything. You can leave it blank. Make sure the slug matches what you see in your category archives.
Save your changes.
Step 2: Create a Child Page of the “category” Parent
In step 2, create another page for each category archive that you want to replace. Make all of them direct children of the parent dummy category page that you created in Step 1. Like this:
Importantly, ensure that the slug for these child pages exactly matches the slug for each of your categories.
Save your changes. Don’t worry about how the slug structure when you first create the page. Publish your page, reload the editor, and now you’ll see that the slug structure has changed to:
websitename.com/parentpage/childpage
What we’ve done here is we’ve created a page with exactly the same URL structure as the category page!
Step 3: Add the Code to Give Priority to the Page Instead of the Category
Unfortunately, this still doesn’t work. When you load the URL, the category page takes priority over the page URL. So we need to add some code to change this. To learn how to add code, check out my tutorial on how to insert custom code snippets in WordPress.
add_filter( 'request', 'alter_the_query' );
function alter_the_query( $query_vars ) {
// Ignore if in the admin
if(is_admin()) {
return $query_vars;
}
// If asking for a category
if(isset($query_vars['category_name'])) {
// save the slug
$pagename = $query_vars['category_name'];
switch($pagename) {
case "webhosting":
case "anothercategory":
$query_vars = array('pagename' => "category/$pagename");
}
}
return $query_vars;
}
In the above code, I’ve created two lines like this:
case "webhosting":
case "anothercategory":
Each of these represents a category page that I want to replace with a new page. For each additional category that you change, add another line similar to these two. It would have been easier for me to check and see if any pagename matched the category name, but I wanted to keep the loop as efficient as possible.
In the code, I do the following:
- If loading the admin, exit
- If loading a category, check if the slug matches any of our pages
- If yes, then create a query with the URL slug of the page name, and we’re done!
Save your changes, and if all goes well, your category links will now all redirect to the specific page you’ve chosen. Once WordPress brings Gutenberg editing to the category area, you merely need to copy the content over from the page to the category page, delete the above code, and move on with your life.
I hope you found this useful!

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!
Thanks for this, I have been trying to find a great solution to this problem for awhile. I am not using Gutenberg but I am using Elementor and SEOPress and both have limitations when dealing with Category Pages. This is great as it allows me to maintain my permalink structure.
Oh my god, has this always been available? I’ve tried so many other ways to do this, and they all end up being exceedingly complicated. Thank you so much for this tutorial!
Didn’t work for me, I was using elementor page builder. Since both slugs are the same, the elementor got confused and couldn’t return a preview of the page I created under the same slug. Once I activated custom plugin with the code I found in this article, the category instead of returning an element page was returning 404 page. Once I deactivated the plugin, it was returning the regular category page.
Didn’t work for me, when I created the new page to replace the category it just created the url as domain.com/category-page-2/
I was unable to create a matching url
Hi, thank you very much, it works fine.
Unfortunately if you use an individual permalink structure for your posts like: /%category%/%postname%/ , it doesn’t work anymore.
Do you have a solution for this?