Show empty tag and category pages

Hey,

I am looking for a way to make WordPress show "empty" category and custom taxonomy pages. I add custom content to some, but as long as there isn't a post assigned to it, the page is not showing.

Best

Johannes

  • Nithin Ramdas
    • Support Wizard

    Hi Johannes,

    I am looking for a way to make WordPress show “empty” category and custom taxonomy pages. I add custom content to some, but as long as there isn’t a post assigned to it, the page is not showing.

    This is the default workflow of WordPress. If there aren’t any posts assigned to category or taxonomies created then WordPress would show a page not found error message.

    You’ll have to override this by creating a template for how the categories are displayed in your theme side.

    Please check whether you have category.php or archive.php in your themes folder, and share that template in your next reply, so that we could see whether there is any quick workaround regarding this.

    I tried to enable the File Editor for WordPress to check the theme templates, but for some odd reason, it isn’t still displaying.

    You can share the PHP files via Google Drive, Dropbox etc so that we could see whether there is any workaround we could suggest by overriding the templates.

    Regards,

    Nithin

  • Adam
    • Support Gorilla

    Hi Johannes

    Thank you for sharing these files.

    I have attached a zip file to this post, containing all those free template files with a change that should help. Give them a try please and let me know if it works.

    A word of “background”:

    in general the code in these templates checks “if there are posts” and if so they print out one part of the template (that actually displays these posts) but if not, they instead load the “404 not found” template. The change I made should work just fine with a “generic” WP loop so I can assume it will work here too but sometimes themes do introduce some slight changes to that “generic workflow” that might affect this.

    Therefore, if these adjusted files either doesn’t help or e.g. break the site, I will need to take a look at how the them works. In such case, let me know please and, if possible, share entire theme that you’re using with me – just the same way as you shared these templates. I’m sure we’ll be able to find a solution then :slight_smile:

    Best regards,

    Adam