How to build custom Category Archive Pages in WordPress

WordPress category and other archive pages (like tags) are incredibly important for both SEO and UX (user experience). They help users discover groups related content and help search engines crawl your site, index your content and determine topical authority.

But by default, WordPress doesn’t let you customize category pages. At least not easily.

But don’t worry. It’s still very possible to edit your category pages, insert custom content, or even completely redesign them from scratch.

Better yet, most of these methods are no-code or minimal-code approaches.

Here are the best methods to override your category archives and create truly custom category pages.

Note: This tutorial mostly focuses on Category archives, but the same techniques can be used for tag archives or even custom taxonomies that you’ve added to your site.

7 methods to edit & customize category pages

Here are my 7 favorite methods to create custom archive pages in WordPress. None of them are inherently better or worse than the others. Each has its own advantages and disadvantages.

They’re ranked in terms of approximate difficulty (easiest first). Methods that require a plugin rank lower (e.g. page builders)

Methods to create custom category archive pages:

  1. 301 Redirect to custom page
  2. Auto-replace archive with page (hack)
  3. Replace archive with matching page if it exists (php snippet)
  4. Page Builders / Theme Builders
  5. Inject custom content with Archive Control (free plugin)
  6. Inject custom content with theme hooks
  7. Create a custom category template (advanced)

If you’re relatively new to WordPress or not comfortable with PHP code, your best choice is to either use the Redirect Method or a Theme Builder like Elementor Pro.

Using a page builder lets you completely redesign your archive pages with a drag ‘n drop visual editor. It’s like god-mode for your archive pages and you’re only limited by your creativity.

But page builders like Elementor aren’t the only option. If you just want to add custom content to your archives (without overhauling them completely) it’s easy to do. You can add content to your archive pages using Gutenberg (or the classic editor) with the help of a couple free, lightweight plugins.

Why Customize your Category Pages?

Most themes treat category pages as an afterthought. They’re rarely more than a list of posts, ordered by the publish date. There may be some fancy styling or a grid layout, but there’s no real content. In the end, it’s just a list of posts.

But your category pages are incredibly high-value from Google’s point of view. They tend to be linked to on every post from that category, either from your navigational breadcrumbs, or your post metadata.

So why not capitalize on all that internal link-juice and try to rank your category pages for some significant short-tail keyword? Well, you should.

And this is exactly the type of tactics that SEO professionals, bloggers & talented affiliate marketers are using.

Why? Because it’s a natural part of well-executed silo structure.

Here are the 7 different ways to build custom archives:

301 Redirect Category to page

This is by far the easiest method and requires no php code or plugins. All you need to do is create a custom page to replace your category archive, then use a 301 redirect from the archive URL to the page URL.

For example, if your category permalink is domain.com/category/cats you might make a page at domain.com/cats.

Then 301 redirect from domain.com/category/cats -> domain.com/cats.

How to create a 301 redirect?

There are two ways to create 301 redirects in WordPress.

  1. Edit .htaccess (Apache servers)
  2. use a plugin

301 Redirect with .htaccess

Using the example above, you would add the following line to your .htaccess file {

Redirect 301 /category/cats /cats

Please don’t forget to backup your .htaccess file before editing.

Also read: How to add 301 redirects to WordPress via .htaccess (wpbuffs)

301 redirect with a plugin

I recommend using a plugin to manage your 301 redirects. Messing with .htaccess can be intimidating (and risky) for beginners. Redirect plugins handle all the tricky stuff seamlessly, and give you a clean UI to manage large amounts of redirects.

Free Redirect Plugins:

As an example, here’s how to do it with Easy Redirect Manager:

  1. Go to Dashboard >settings > 301 redirects
  2. Redirect from: category/cats
  3. Redirect to: /cats
  4. Click save.
301 Redirect category archive to category page using easy redirect manager

Auto-replace Category Archive with Page (hack)

This method is super simple and is perfect for creating a silo structure if you have a flat category architecture. But it’s also a hack(y) method, so I’d recommend choosing the next method (php snippet) instead.

You should know: This method has one major drawback. If you have child categories, you must create a page for each sub-category or the archive will result in a 404 error.

How it works

By setting the category base to a period (.), WordPress will strip /category/ from the permalink. If a page with the same permalink exists, it will take priority over the archive. If no page exists, the default archive page will show.

1. Set the category base

  1. From the dashboard, go to Settings > Permalinks
  2. Scroll down to the ‘Optional’ section
  3. Set the Category and/or Tag base to a period .
  4. Click save
Set the category base to period in permalink settings

2. Create your custom category pages

By changing the category (or tab) base, your archive URL structure will now be domain.com/archive-slug.

So to override the default archive template, just create any page with a matching slug. You don’t need to create a page for every category, just the ones you want to customize.

Example: If your category slug is /latest-news/ create a page with the permalink /latest-news/

How to create your custom pages: You can use any builder, editor, or tool you want to create your custom pages. The best part, is you can even use the free version of popular page builders like Elementor. No theme-builder or pro subscription required.

  • Gutenberg block editor
  • Classic editor
  • Page builders (works with all builders, including free version)
    • Elementor
    • Beaver Builder
    • SeedProd
    • Zion builder

3. Prevent 404 Errors

As I mentioned above, this method will only fall-back to the default archive template for top-level categories and tags. If you use nested sub-categories (e.g. /category/news/local/) then every sub-category must have a custom page or it will return a 404 error.

To create a page for sub-categories:

  1. Create a page with the permalink that matches the top-level category
  2. Create another page with a slug that matches the sub-category
  3. In the editor for the child page, go to Page Attributes
  4. Select the parent-category page as the parent of the sub-category page
Set the Parent-Category page as the parent of the Child-Category

Now the child page will have the permalink /parent-category/sub-category which matches the archive structure and there should be no 404 error.

Note: This means that if a category has sub-categories, you must create a custom page for the top-level category as well. It can’t use the default archive. That’s why this method is best if you have a very flat archive structure (few sub-categories).

Auto-Replace Category w/ Page (PHP Snippet)

The best method for building truly custom category pages without 3rd-party plugins or page builders

Unlike the hacky method above, this method is future-proof, has no major drawbacks, and only requires a bit of PHP code.

How it works

Whenever WordPress loads a category page, this php snippet checks if there is a page that matches the archive’s permalink structure. If so, it loads that page instead. If not, it defaults to your theme’s category template.

1. Add the PHP Snippet

Put this code in your theme’s functions.php file, or better yet a plugin like Code Snippets (which is awesome).

There are two slightly different versions of this code, depending on whether you use /category/category-name or /category-name as your permalink structure (if you have the remove category base option enabled in your SEO plugin for example).

Here’s the code for the default WordPress structure of /category/category-name:

<?php
  add_filter('request', function(array $query_vars) {
    // do nothing in wp-admin
    if(is_admin()) {
        return $query_vars;
    }
    // check if the query is for a category archive
    if(isset($query_vars['category_name']) && !isset($query_vars['name'])) {
      	
      //generate the page path
        $pagename = 'category/' . $query_vars['category_name'];
		
      //attempt to load the page matching the $pagename slug
		$page = get_page_by_path( $pagename , OBJECT );

     if ( isset($page) ){
        // completely replace the query with a page query
        $query_vars = array('pagename' => "$pagename");
	 }
    }
    return $query_vars;
});

And if you’ve removed the /category/ base from your permalinks, make this slight tweak to the code. Simply modify the line starting with $pagename to match this:

<?php
  	// generate the page path
	$pagename = $query_vars['category_name'];

2. Create your custom category pages

You can use any page builder (or the default WordPress editor) to create your custom pages. The only tricky part is making sure to match the permalink structure of your pages correctly.

Here’s how:

If your permalinks have the /category/ base (default)

  1. Top-level page: Create a page with the slug of /category. This will be the top-level page to hold all our custom category pages. It won’t be displayed and can be no-indexed and redirected to your homepage or blog page.
  2. Top level categories: The slug should match category name and the parent page should be set to the /category top-level page.
  3. Sub-categories: The slug should match the sub-category name, and the parent page should be set to the parent-category page.

Example:

Let’s say you have a category /news/ with a sub-category /news/local/

  1. Create a page with the slug of ‘news’. Set the parent page to ‘Category’
  2. Create a page with the slug of ‘local’. Set the parent page to ‘News’.

If your permalinks have removed the /category/ base

If you’ve removed /category/ from your URLs so your category URLs are /category-name, then you only need to make one modification.

Don’t create a top-level ‘category’ page (step #1 above).

Instead, top-level category pages should have no parent, and sub-category pages should set the parent category as the parent.

3. 301 Redirects & Cleanup?

The beauty of this method is you don’t need any redirects (other than the single /category page). The URL structure of your pages exactly matches the category permalink structure, so it’s impossible to access the custom pages from a different URL.

Use Page Builders

The easiest method for non-devs is to use one of the several pagebuilder plugins that let you override or customize your archive templates.

These page builders will handle all the messy code behind the scenes and let you quickly build gorgeous, custom category pages really fast. Authority Hacker loves using Elementor for this, even on their high-traffic blog.

Page Builders to build custom archive pages:

  1. Elementor (pro-only)
  2. Thrive Theme Builder (THEME)
  3. Beaver Builder + Beaver Themer (pro-only)
  4. Divi (pro-only)

Note: All of these plugins require the pro/paid version to access theme-builder features. Currently there are no free page builders that let you customize your archive pages.

Of these options, I recommend Elementor Pro. It’s the most popular, has the largest add-on community and is making huge strides in the speed department. Thrive Theme Builder would be my #2 pick.

Beaver Themer is good, but it’s annoying that you have to buy a second paid addon to an already-pro plugin. It’s hard to recommend Divi due to bloat and lock-in. It also has the slowest load times of the 4.

How to build custom category pages w/ Page Builders

Here you’ll find instructions for each of the page-builders mentioned above

Follow these basic steps to create a custom archive template with Elementor Pro:

  1. Install and activate Elementor Pro
  2. Go to Templates > Theme Builder > Archive > Add New
  3. Select Archive from the dropdown and click Create Template
  4. Add an Archive Block widget to your template
  5. Add as many other blocks as you want to customize your template
  6. Configure the Conditions to choose which archives will use your custom template

Unlike the other plugins on this list, Thrive Theme Builder actually overrides your theme (much like Oxygen Builder). So you’ll be entirely replacing your theme. This is not something to be taken lightly and is better done early in the development process for a young website.

Customizing your Category Archives with Beaver Builder is easy, but there’s a catch. You need both the paid version of Beaver Builder, plus the Beaver Themer pro addon.

There’s a two-plugin bundle available, but it’s still more expensive than Elementor Pro (which includes the features from both).

Edit Archives w/ Archive Control (plugin)

Archive Control is a free plugin that might appear simple at first glance, but can be insanely powerful if you know what to do with it.

What it does: Archive Control lets you inject custom content before (or after) the default loop on your archive or category pages. You can customize this on a per-category basis.

Customization Methods:

  1. Simple: Use the text-based editor to add simple WYSIWYG content (including shortcodes)
  2. Advanced: Combine with the Insert Pages plugin to inject content from any page, post, or custom post type into your archive page. This way you can design the content in Gutenberg (or other page builder) than inject it into your archive page.

Basic Setup

Before you can start editing your category pages, you need to choose which options will be available on the edit page for each category.

  1. Go to Settings > Archive Control > Taxonomies
  2. Activate the features you want by setting them to Enabled
    • Category Title: Edit the archive title
    • Content Before List: Insert content before the default loop
    • Content After List: Insert content after the default loop

And if you want to get really advanced, you can even enable ‘Per Term Order & Pagination‘ to customize the loop sorting on each individual archive page.

Per-Term ordering for the default loop on archive pages

Simple Customization

If you just want to add some text-based content or shortcodes to your archive pages, all you need is the built-in features of Archive Control.

  1. Enable the features you want (as discussed in Basic Setup). Content Before List & Content After List are a good start.
  2. Go to Dashboard > Posts > Categories
  3. Select the category you want to customize and click Edit
  4. Add your custom content to the Content Before (or after) List text box.

For example, if you wanted to inject a simple paragraph of text above the loop on your archive page, enter it in the Content Before List box (see example below)

Insert content before the loop using Archive Control

Which will result in this on my category page:

Advanced Customization

By installing a second plugin called Insert Pages, we can pull the full content of any page, post or custom post type and insert it into the ‘Before’ or ‘After’ text boxes using a shortcode. This lets you build out a complete design using any page builder or plugin (including free ones).

How to do it:

  1. Install & Activate the Insert Pages Plugin
  2. Create a New Page Dashboard > Pages > Add New
  3. Add content to the page (can use a page builder if you want)
  4. Publish the page as Private (won’t show on the front-end).
  5. Get the ID of the private page
  6. Add the insert pages shortcode to Archive Control

The shortcode is formatted like this:

[insert page="ID"]

So if the ID of your page is 254, then the shortcode would be:

[insert page="254"]

So we’ll just add that to the Content Before List text-box on a category page, and the full content of the page will be injected before the loop on your category page. This is great for inserting styled text, links, CTA’s, or even complete full-page templates.

Customize Archives using Theme Hooks

This method is similar to the Archive Control technique described above. We’re not overriding the template completely, just injecting custom content into the page (usually before the loop of posts).

Why use this method:

  1. No extra plugins required
  2. Works with shortcodes, text and Gutenberg Blocks (for some themes)
  3. Zero PHP

Downsides of this method:

  1. It only works with a small number of compatible themes that include a user-friendly Hooks module
  2. You can inject content, but not customize the loop itself

Requirements: You must have a hook-based theme, preferably the pro version with a visual hook builder.

Compatible Themes (not an exhaustive list)

  • GeneratePress Premium
  • Astra Pro
  • Blocksy Pro
  • Neve Pro

Setting it up:

  1. Use your theme’s Hooks Module to create a new hook
  2. Add content to the hook (via the visual editor)
  3. Choose a hook location and display rules (check your theme documentation for which hook to use)
  4. Publish your hook and verify it’s working on the front-end.

Astra Archive Hooks

Astra makes this really easy since it has an archive hook location immediately before the archive loop and immediately after. Here’s the correct hook to use:

  • Before the loop: astra_content_while_before
  • After the loop: astra_content_while_after
Astra hook on archive page between title and loop

GeneratePress Archive Hooks

I recommend using the generate_archive_title hook, which is not listed in the visual hooks guide. Then set the priority to 1 so it’s injected after the archive header element, before the main loop.

Another option would be to use the generate_after_archive_title hook if you don’t mind the content being inside the archive <header> element.

Edit Category Templates w/ PHP

This is the last option because quite frankly it’s not suitable for beginner or intermediate WordPress users. You should be comfortable with The Loop and basic PHP syntax before even attempting to edit your template files directly.

But if you’re comfortably writing PHP and HTML, this method will give you complete control over the layout of your category and archive pages.

Advantages:

  1. Fully control over your archive template
  2. No bloated plugins or other drags on load time

Disadvantages:

  1. Requires PHP skills
  2. Misplaced semi-colon can break your site (see #1)
  3. Much slower than using a page builder (or Gutenberg blocks)

Recommended Tutorials:

Editing Category Pages with Gutenberg Blocks

With many of the methods above, you have the option to build your archive page from scratch or inject content into the existing page. In either case, you’ll often have the ability to use Gutenberg Blocks to add that custom content.

There are a couple reasons I prefer blocks to shortcodes. Performance is one, as blocks enqueue their scripts & styles on a per-block basis, rather than having to load the bulky stylesheet for component. Secondly, they have an easier, visual UI compared to shortcode-based plugins.

Which blocks to use?

There are thousands of blocks to choose from, but here are some suggestions for building out your category pages.

  1. Post Grid: Use a free post grid plugin like kadence blocks or stackable to replace your theme’s generic list of posts.
  2. Call to action: Add a CTA to the top of your archive to generate more sales or opt-ins. Ideal plugins include Ultimate Addons, Elementor, or build-your-own with core blocks.

What about full site editing?

Full Site Editing (FSE) will eventually make most of these other methods unnecessary. At least that’s the hope.

Eventually, FSE-compatible themes let you edit their template files by dropping in Gutenberg blocks instead of PHP code. It’s still early days and there’s only a handful of compatible themes, but eventually FSE will filter down to popular production-ready themes too.

In the meantime, choose one of the other methods above. FSE simply isn’t ready yet for serious production websites.

And don’t worry about your method of choice becoming obsolete. WordPress is obsessive about backwards-compatibility and I expect all of the above methods should work just fine for years to come. Quite possibly forever.

In fact the only method I have any concern about is the Page-Overrides-Archive hack by setting the Category Base to a .

Everything else should be future-proof. 🤞

Which method to choose?

There’s no ‘right’ method, and each of these techniques will be the best choice for different people. It comes down to your time constraints, technology stack, WordPress skills and project needs.

But here’s a basic breakdown of when to use what:

  1. 301 Redirect Method: Use this if you already have a hub page in place or just want to get up and running fast. It’s simple & effective.
  2. Replace Archive w/ Page (hack): Only consider this if you’re terrified of PHP and have a very flat category structure (few sub-categories).
  3. Replace Archive w/ Page (PHP): An all-around solid option if you want to customize more than one or two archive pages but want to keep the URL structure (no 301 redirect).
  4. Page Builder: Best for non-devs who want full design control. It’s the best no-code option and the best ease-of-use. No-brainer if you’re already using a compatible builder
  5. Archive Control Plugin: Zero-code alternative to method #3, but requires at least 2 plugins if you want to inject Gutenberg blocks. Also, you can’t replace the loop entirely (but you can modify it).
  6. Theme Hooks: Best for adding custom content to archive pages (like a CTA) without necessarily rebuilding it entirely. Can’t customize the loop at all.
  7. Custom Templates (php): Devs only. If this is the best option for you, you’d know already.

15 thoughts on “How to build custom Category Archive Pages in WordPress”

  1. I had no idea there were so many possibilities! I’ve been wanting to customize my category pages for years and just thought I didn’t have the skill to do it. Thank you for all these tips!

    Reply
  2. Thank you so much for this! #3 was exactly what I needed AND you even thought to include both options with or without the categories! Works great!

    Reply
  3. Hello, excellent info here thank you!

    I’m using the Replace Archive w/ Page (PHP) method with category stripped and added via code snippets.

    I modified the PHP code based on your suggestion if the category is stripped.

    I create a post with the same URL slug as the category.

    However, the post redirects to the category page.

    I’m using a generic install of GeneratePress premium.

    Not sure what to do from here. Any ideas?

    Reply
  4. This is helpful! Method 3 looks like the right one for me.

    My category base is set to “topic.” Do I replace only the “category/” in the snippet with “topic/”, and set the top-level page to “topic”?

    Reply
    • That’s a good question. I haven’t tested it with a modified category base like ‘topic’. I’d try the modifications you mentioned first. If that doesn’t work, it’s possible the query var is no longer ‘category_name’ and you’d have to figure out what it is. You could use a plugin like Rewrite Rules Inspector or Query Monitor to see what query var is being used.

      If you get it working, I’d love to hear back so I can update the article.

      Reply
  5. Thanks Matthew, I’m going to try it sometime next week when I hopefully have a better opportunity to concentrate. (Guests will be gone…).

    I hope it will work. I will let you know either way.

    Reply
  6. Thank you so much! I used #3 “Auto-Replace Category w/ Page (PHP Snippet)”. I’ve spent way too long looking for code to load a page before a category and this works perfectly with rank math stripped category option and Generatepress/blocks!

    Reply
  7. Great article, really clear.

    However, when I use Archive Control in combination with Insert Pages, the inserted pages don’t look at all the same as they do in their original form, all the styles/fonts/background colours etc are completely lost. Is there a way to rectify this?

    Thanks

    Reply
    • It depends where the styles are coming from. For example, if the CSS rules are using .single as a part of the selector for the CSS rules, they won’t apply on archive pages. Are these theme styles you’re talking about? Or styles from Gutenberg Blocks or a page builder?

      Reply
  8. Hi Matthew,

    I have been painstakingly and equally frustratingly been trying to figure out and it’s been an absolute nightmare, I found you post after hours of searching online and tried #3 and it works like a charm…..phew…thanks so much.

    Just two questions? for indexing and seo purposes, should I then no index the categories to potentially prevent duplicate content;

    And with regards to sub categories, I don’t want to create a parent page and subpage, so could I just add sub category post titles to the main page (Hope that makes sense?)

    Reply
    • You don’t need to no-index the archive pages. The archive you’re replacing won’t be visible to google anyway, and the child archives will be the same as they always were (if you don’t create a replacement page).

      For sub-categories, you don’t have to create a replacement page using this method. It only loads your custom page if it exists, otherwise it loads the default archive. You can certainly still include your child posts in your custom top-level archive in its own section. You could even link to the child archive page from that section if you want, to help Google crawl your site better.

      If you’re concerned about duplicate content, you could test both methods (index / no-index) on different categories to see which one results in better rankings.

      Reply
  9. I am just commenting to say thank you…. I was so depressed when I saw I can only redirect category archives on content views premium version. I searched a lot but couldn’t find a free solution. But thanks to your article. This solved my problem. Sorry about the grammatical mistakes and thank you so much. I hope you live happy life. cheers.

    Reply

Leave a Comment