WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a specific page unsearchable. I don't want it's text to show up when i'm searching some text in the search box (on the sidebar on most themes).

share|improve this question
I'm guessing i would have to edit The-Loop in some way, but how? – vsync Dec 19 '12 at 23:59
Please always add additional info to the question as edit instead of adding comments. Thanks. – kaiser Dec 20 '12 at 8:02
function hide_from_search($qry) {
  if (is_search()) $qry->query_vars['post__not_in'][] = xXx;
  return $qry;

The xXx is the ID number of the page to exclude. Just read it out of the URL on the backend. When you are editing the page you want to exclude look at the URL bar. You should see "post=xXx" in there.

share|improve this answer
cool, thanks. I ended up putting this in the beginning of The Loop: if( get_post_type() != 'page' ) : ... because i wanted to search only inside posts anyway and not inside pages – vsync Dec 23 '12 at 18:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.