Home / category / Redirect to a single post if one post in category or tag
  • Anderson Luiz Narciso

    Mannn u save me (L), i was using a plugin to redirect, but is a lot of work put link by link to
    redirect, and its shape redirects all at once, very good, and thank u

    • @google-bbb748471f941d6cd59d0e099de0729c:disqus  cool glad that I could help out.

  • Sean

    Hey there Kevin, I am having a similar issue I believe. Big G indexed a bunch of  category archives, now I have like 8 listings in the serps.. I was looking around on how to just redirect all categories to the homepage. Its a WP blog, and I read something about htaccss. 
    Is this similar to what you posted above?Thanks mateRu

    • Well the above script checks to see if a category has a post however you could simply check if it is an archive and then redirect to homepage.

      function redirect_to_home(){
          if( is_archive()){
              wp_redirect(home_url());
          }
      } add_action(‘template_redirect’, ‘redirect_to_home’);

      • Michiel Holtgreve

        Thanks a lot Kevin! This works also for me. Was looking for this for a long time!

  • Riversatile

    Your snippet is great !!!

    • Cool thanks  Riversatile glad you like it.

  • Adm

    great & Cool !!! thanks…

  • Pingback: WordPress Function Redirect to Single Post in Category or Taxonomy | Ellen Jane Moore()

  • Pey

    Worked like a charm. Excellent and Thank you.

  • Nanno

    not sure where on paste the code in function .php :(
    HELP