WordPress.org

Support

Support » How-To and Troubleshooting » Turn off category pages all together

Turn off category pages all together

  • Is there a way to not display a category page at all?

    say a user navigates to http://www.yoursite.com/category/myCategory

    Right now the user will be served all the posts in the category. Well, I wouldnt like them to view my site in that way. I would rather have them redirected back to the homepage, or something like that.

    Thoughts?

Viewing 9 replies - 1 through 9 (of 9 total)
  • This thread might explain a little more for you. If not, maybe one of the threads from this search result will help, or, maybe someone else could help you better? Good luck!

    spencerp

    You could set up a primary category template (category.php) for your current theme, and within it have only:

    <?php
    header( 'Location: ' . get_bloginfo('home') );
    ?>

    That may be a little jarring for most, so perhaps a better idea would be to copy your index.php to category.php, strip out The Loop, and provide informative content that helps direct your readers.

    Thank God, Kaf replied in here lol! You should be in good hands now. ;):) Thanks Kaf, you’re awesome.. 😉

    spencerp

    You should be in good hands now.

    That all depends on what’s in my hands at the time. ;)

    Hahaha, that’s true though…lmao! 😉 🙂

    spencerp

    Hey guys – thanks for the replies. Tell me if this is not the way to go…

    I created a category.php and all it has in it is a meta refresh to the homepage.

    what issues will come of this?

    thx again!

    I guess that my way is fine.

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    Meta-refresh is generally frowned upon, because it’s heavily browser dependent. Use a real Location: header like Kaf suggests above instead. All browsers support that, because that’s the spec.

    Thx Otto!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Turn off category pages all together’ is closed to new replies.