• Hi everyone!

    I’m using the Page Links To-plugin, which allows me to redirect links to pages in my menus to, well, any link I’d like. But recently, I noticed that the pages that are only used as redirects are still found and listed by the internal WordPress search engine, which could lead to misleading results for visitors.

    I’ve tried to use the WP Hide Post-plugin to hide the pages from the search engine, but that didn’t cut it – it allowed me to either hide the page entirely (which would include removing the link in the menu) or not at all. Are there any other solutions to my problem?

    Thanks,
    Anders

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try amending the Loop in search.php to use something like:

    <?php if (have_posts()) :  while (have_posts()) : the_post(); ?>
    <?php if(is_page(array('Foo', 'Bar', 'Wibble')) continue;?>

    where Foo, Bar, Wibble are the titles of Pages that you don’t want to show.

    Thread Starter Anders Norén

    (@anlino)

    Didn’t work, I received the following error:

    Parse error: syntax error, unexpected T_CONTINUE in C:\xampp\htdocs\wordpress\wp-content\themes\bluebox\search.php on line 10

    I also have this problem. I’m using a simple redirect on my pages to send users to a different part of my website (shop,community,etc). Also when one of those pages show up in a search result it redirects from the search page to where ever that page was redirected to.

    You can check out the problem on my page: http://www.spaceageminds.com

    The pages that redirect is “Products” and all of its subpages and “Community” and all of its subpages.

    If you do a search for “community” the page shows up in the results and after 1 or 2 seconds redirects the user.

    edit: Also I don’t have a search.php in my theme. I’m using a modified Lightword theme I think this is the code responsible for my search but I have limited wordpress skills so I might be wrong.

    // SEARCH BOX / WORDPRESS BASIC SEARCH OR GOOGLE CSE
    
    function lw_searchbox(){
    global $lw_remove_searchbox, $lw_google_search_code;
    $lw_google_search_code = trim(str_replace(" ","",$lw_google_search_code));
    if($lw_remove_searchbox != "true")
    if(!empty($lw_google_search_code)){
    ?>
    <form action="http://www.google.com/cse" method="get" id="searchform">
    <input type="text" class="textfield" name="q" size="24" id="s"/>
    <input type="submit" class="button" name="sa" value="" id="go"/>
    <input type="hidden" name="cx" value="<?php echo $lw_google_search_code; ?>" />
    <input type="hidden" name="ie" value="UTF-8" />
    </form>
    <?php }else{ ?>
    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>"> <input type="text" value="" name="s" id="s" /> <input type="submit" id="go" value="" alt="<?php _e('Search'); ?>" title="<?php _e('Search'); ?>" /></form>
    <?php
    }
    }

    Anything at all would be helpful.
    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Hiding pages from the WordPress search’ is closed to new replies.