WordPress.org

Ready to get started?Download WordPress

Forums

Turn off category pages all together (10 posts)

  1. shua
    Member
    Posted 7 years ago #

    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?

  2. spencerp
    Member
    Posted 7 years ago #

    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

  3. Kafkaesqui

    Posted 7 years ago #

    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.

  4. spencerp
    Member
    Posted 7 years ago #

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

    spencerp

  5. Kafkaesqui

    Posted 7 years ago #

    "You should be in good hands now. "

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

  6. spencerp
    Member
    Posted 7 years ago #

    Hahaha, that's true though...lmao! ;) :)

    spencerp

  7. shua
    Member
    Posted 7 years ago #

    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!

  8. shua
    Member
    Posted 7 years ago #

    I guess that my way is fine.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  10. shua
    Member
    Posted 7 years ago #

    Thx Otto!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.