Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressの検索結果からページを除外する方法(ステップバイステップ)

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

WordPressの検索結果からページを除外する方法を知りたいですか?

初期設定では、WordPressのビルトイン検索はすべての投稿とページを検索結果に含めます。訪問者が探しているものを見つけやすくするために、特定のコンテンツを除外して、検索結果に表示されないようにすることができます。

この投稿では、WordPressの検索結果から特定のページを除外する方法を順を追って説明します。

How to exclude pages from WordPress search results (step by step)

なぜWordPressの検索結果からページを除外するのか?

WordPressの初期設定では、検索結果にすべての投稿とページが含まれます。

しかし、これはすべてのサイトでうまく機能するとは限りません。例えば、オンラインストアを運営している場合、アカウントページ、購入手続きページ、サンキューページなどのページを非表示にしたいと思うかもしれません。

同様に、会員制サイトを運営している場合やオンラインコースを販売している場合は、購読者限定のコンテンツが一般の検索結果に表示されないようにしたい。

それでは、WordPressの検索結果からページを除外する方法をご紹介しましょう。このチュートリアルのナビゲーションには、以下のクイックリンクを使用できます:

:このガイドでは、サイト訪問者がサイトの検索ボックスを使ってコンテンツに目を通す、サイト内検索に焦点を当てています。

Googleの検索結果からページを除外したい場合は、WordPressのページをGoogleから非表示にする方法をご覧ください。

ステップ1:WordPress検索プラグインのインストール

WordPressの検索結果からページを除外する最も簡単な方法は、SearchWPプラグインを使用することです。これは、30,000以上のサイトで使用されているWordPress用の最高の検索プラグインです。

SearchWPを使えば、コメント、カスタム投稿タイプ、PDFファイル、WooCommerce商品、カテゴリーなど、WordPressが初期設定で無視しているコンテンツを検索することができます。コンテンツを除外することもできます。

さらに詳しく知りたい方は、SearchWPのレビューをご覧ください。

最初に行う必要があるのは、プラグインのインストールと有効化です。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

有効化したら、SearchWP ” Settingsに行き、’General’タブをクリックする。

Activating the SearchWP WordPress plugin

ここで、「ライセンスキー」ボックスにライセンスを入力する必要があります。この情報は、SearchWPサイトのあなたのアカウントの下にあります。入力が完了したら、’Verify Key’ボタンをクリックしてください。

ステップ2:カスタム検索アルゴリズムの作成

プラグインを有効化した後、SearchWPがどのようにインデックスを作成し、検索し、コンテンツを表示するかを微調整することができる。あなたのWordPressブログやサイトのためだけのカスタムGoogle検索アルゴリズムを作成するようにこれを考えることができます。

検索結果からページを除外する前に、サイト全体の検索エンジンを作成する必要があります。

Creating a custom search algorithm in WordPress using SearchWP

ここでは、ページ、投稿、メディアファイルなど、SearchWPが初期設定で検索する異なるコンテンツタイプのセクションが表示されます。

各セクションには独自のアプリケーション属性関連性スライダーがあり、SearchWPがあなたのオンラインマーケット、ブログ、サイトのコンテンツをどのようにランク付けするかをコントロールすることができる。

例えば、「タイトル」スライダーを左に、「コンテンツ」スライダーを右に動かすと、コンテンツがタイトルよりも重くなります。

Changing the attribute relevancy scale

検索結果からすべてのページを除外することも、特定のページだけを除外することもできる。

WordPressサイトの検索結果にすべてのページが表示されないようにするには、「ページ」の隣にある小さなゴミ箱アイコンをクリックします。

Excluding all pages from the WordPress search results

ページ」のチェックを外すポップアップが開きます。

その後、「完了」をクリックするだけで、検索バーと検索結果からすべてのページが除外される。

How to exclude all pages from your site's search results

初期検索エンジン設定のカスタマイザーが終わったら、変更を保存しましょう。特定のページを除外する場合でも、最初にサイト全体の新しい検索アルゴリズムを保存する必要があります。

これを行うには、画面を一番上までスクロールし、「保存」ボタンをクリックします。

Saving the custom search algorithm using SearchWP

SearchWPはインデックスを自動的に再構築します。インターネット接続の速度とWordPressホスティングサービスによっては、数分かかる場合があります。

Index Status 100%’ と表示されれば、SearchWPがすべてのコンテンツと設定をインデックスしたことがわかります。

Rebuilding the search index in WordPress

サイトが自動的にWordPressの検索 機能を使用するようになります。

ステップ3:WordPressの検索結果から特定のページを除外する(オプション)

WooCommerceの購入手続きページなど、特定のページを検索結果から除外したいですか?

上記のプロセスに従ってサイト全体の検索アルゴリズムを作成した後、検索結果から個々のページを除外することができます。

これを行うには、Exclude UIエクステンションを使用します。このエクステンションは、ページエディターに「検索から除外する」ボックスを追加します。

WordPressダッシュボードで、SearchWP Extensionsに向かいます。ここでExclude UI拡張機能を見つけ、その「インストール」ボタンをクリックします。

Installing SearchWP search extensions

その後、検索結果から除外したいページを開きます。右側のメニューで「ページ」タブが選択されていることを確認します。

これで、「検索から除外する」ボックスにチェックを入れることができる。

Exclude from search checkbox

その後、「更新」ボタンをクリックするだけで、このページは検索結果に表示されなくなります。さらに多くのページを検索結果から非表示にしたい場合は、上記のプロセスを実行するだけです。

ステップ 4: 検索フォームを作成して埋め込む

さて、ページを除外するカスタム・ワードプレス検索エンジンを作成したので、そのエンジンを使って検索フォームを作る必要がある。

すべてSearchWPSearch Formsに行き、’新規追加’ボタンをクリックするだけです。これでカスタマイズ可能な新しい検索フォームが作成されます。

Adding a custom search form to your WordPress website

ステップバイステップの手順については、カスタム WordPress 検索フォームの作成方法をご覧ください。このガイドでは、検索フォームを作成し、ページ、投稿日、ウィジェット対応エリアに埋め込む手順を説明します。

検索バーに検索フォームを追加することもできます。クラシックテーマを使用している場合は、SearchWP モーダル検索フォームプラグインを使用する必要があります。

The SearchWP native search template

ブロックテーマを使用している場合は、ナビゲーションメニューにSearchWPフォームを追加するためにフルサイトエディターを使用することができます。

より詳しい情報は、WordPressメニューに検索バーを追加する方法をご覧ください。

ボーナスのヒントWordPressの検索結果から投稿、タクソノミーなどを除外する

WordPressの検索結果をさらに微調整して、特定のコンテンツのみを検索結果に含めたい場合があります。プライベート投稿、ユーザーに検索してほしくないカスタム投稿タイプ、タグのような特定のタクソノミーなどの項目を除外するのに便利です。

例えば、タグを検索結果から除外することは、社内で整理するためにタグを使用しているが、ユーザーを混乱させたくない場合に有効かもしれない。

このような場合は、WordPressの検索から特定のページや投稿者などを除外する方法をご覧ください。

もう一つの設定は、検索結果から特定のページカテゴリーを除外することです。これを行うには、ページを分類するための明確なシステムが必要で、少し計画が必要かもしれません。ただし、追加のエクステンションをインストールする必要はありません。

特定のカテゴリーのページのみを表示するには、WordPressでカテゴリー別に検索する方法をご覧ください。

WordPressの検索結果からページを除外する方法について、この投稿がお役に立てば幸いです。また、サイト用の無料SSL証明書を取得する方法についての初心者向けガイドや、中小企業に最適なビジネス電話サービスもご覧ください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

38件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Ivan says

    Thanks. This worked for me. I wanted to exclude gallery appears in search results and this code does exactly what I need. Thanks

  3. Pete says

    This is really basic. It would be nice to see how to exclude only particular page templates, or blog categories.

  4. Gautam Nagraj says

    Hello team WPBeginner

    I am facing a new problem

    when I have tested crawled pages on Google by writing

    site:example.com

    Then it showing pages & posts properly but also showing pagination links

    example.com/page/2/

    Like this

    So how can I avoid this?

    Please help me.

  5. Laura Rafferty says

    Wondering if there’s a way to target different search forms with this technique. I’d like the main website search form to target pages only; and the blog search form to target posts only.

  6. Val says

    I have some pages that are password protected (via main WP option to password protect a page) but they are still showing up in WP search with the excerpts. My understanding is that by default, the excerpts should not appear, you should see “There is no excerpt because this is a protected post.” I can use the Simply Exclude plugin but I’m wondering why the excerpts are showing up in the first place and I’d rather not add another plugin if I don’t have to.

  7. Victor says

    Thank you very much. You guys did the trick. I was looking for this and couldn’t find it anywhere else.
    Nice job, guys.

  8. Noah says

    When someone just hits SEARCH with the criteria being ‘blank’, ALL pages show up in the results. How can I have NO results show in this situation?

    • Jornes says

      Noah, if you are saying about search result, you can validate the search form using javascript. So that people are forced to key in the words before do the searches.

  9. Laura says

    This worked great, thanks! How can I include WordPress Native BBPress forum topics in the search results?

    Thanks,

    L

  10. Jornes says

    Hi! I would like to ask how do i exclude the specified pages i wanted to excluded from searches? And how do i know what is the ID of the page? Can someone tell a solution? I wanted to excluded some pages which are useless to visitors.

    Thank you!

  11. Spyridon says

    You are a real life saver. I tried codes from WordPress forum but didn’t work out. Yours is working for me! :D

  12. gormanIT says

    Can you alter this function to exclude specific pages/posts from search? Ive been searching for this functionality and havent found anything.

  13. Katie says

    Well, that’s almost perfect. I searched and found that many site’s offering us to hardcode the category ids to search id but this is cool. One question, i have to do the pagination myself so when i add this filter i won’t get offset issues .. right?

  14. Mohsen says

    Hi
    may I put your tutorials in my blog with a link to wpbeginner.com? my blog is in Farsi and I think many persian users need these tips.
    thanks a lot

  15. Rilwis says

    This hack excludes not only pages from search results, but also other custom post types. So if we have many custom post types in our WP site, we can put them in the statement like this:

    $query->set(‘post_type’, array(‘post’, ‘custom-post-type’));

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。