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でRSSフィードを無効化する方法(2つの簡単な方法)

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

WordPressサイトのRSSフィードを無効化したいですか?

RSSフィードは、ユーザーがあなたのブログ投稿を購読することを可能にします。しかし、小規模な静的サイトを構築する際には、RSSフィードをオフにしたい場合があります。初期設定では、WordPressにRSSフィードを削除するオプションはありません。

この投稿では、WordPressでRSSフィードを無効化する方法を紹介します。

How to disable RSS feeds in WordPress

RSSフィードとは何か、なぜ無効化するのか?

RSSはウェブフィードの一種で、ユーザーがあなたのサイトの更新やコンテンツをリアルタイムで取得できるようにするものです。RSSはReally Simple SyndicationまたはRich Site Summaryの略です。これにより、読者はメールマガジンやRSSフィードリーダー、その他の端末で自動的に新しいコンテンツを入手することができます。

RSSフィードはサイトにとって便利ですが、WordPressは役に立たないかもしれない複数のフィードを追加することができます。例えば、タクソノミーフィード、著者フィード、個々の投稿やページフィードなどがあります。

これらのRSSフィードを無効化することで、Googleのような検索エンジンがサイトのクロール枠を使い果たすのを防ぐことができます。こうすることで、検索エンジンのボットはサイトに関係のないフィードをクロールせず、より重要なページをインデックスするようになります。

さらに、RSSフィードを無効化することは、WordPressブログを運営しているのではなく、WordPressをCMS(コンテンツ管理システム)やシンプルなサイトビルダーとして使用している場合にも意味があります。ブログを持たないeコマースストアにも最適です。

WPBeginnerでは、SEOランキングを向上させるために、いくつかのRSSフィードを無効化しています。

ということで、WordPressでRSSフィードを無効化する方法を見てみましょう。

方法1:プラグインを使ってRSSフィードを無効化する

RSSフィードを無効化する最も簡単な方法は、All In One SEO(AIOSEO)のようなWordPressプラグインを使うことだ。

WordPressのための最高のSEOプラグインであり、専門知識を必要とせず、専門家を雇うことなく、検索エンジン向けにサイトを最適化することができます。

All In One SEO - AIOSEO

この方法は簡単なので、初心者の方におすすめです。このチュートリアルでは、WordPressのRSSフィードを無効化できるAIOSEO Lite版を使用します。

しかし、検索順位を上げたいのであれば、AIOSEO Proバージョンを使用することで、XMLサイトマップやリダイレクトマネージャー、Broken Link Checker、Link Assistantなど、より強力な機能を利用することができます。

まず最初にAIOSEOプラグインをインストールして有効化します。詳しくはWordPressプラグインのインストール方法をご覧ください。

有効化すると、セットアップウィザードが表示されます。Let’s Get Started」ボタンをクリックし、画面の指示に従ってください。詳しくは、WordPressでAll In One SEOを設定する方法のガイドをご覧ください。

Click let's get started AIOSEO setup wizard

次に、WordPressダッシュボードからAll In One SEO ” 検索外観に行き、「詳細設定」タブに向かいます。

その後、「Crawl Cleanup」オプションまでスクロールし、トグルをクリックして有効化することができます。

Go to AIOSEO advanced settings in search appearance

クロールクリーンアップオプションを有効化したら、無効化したいRSSフィードまでスクロールするだけです。

グローバルRSSフィードを有効にしておくことをお勧めします。RSSフィードを有効にしておくと、購読しているユーザーが最新の更新情報を得ることができるからです。無効化すると、あなたのサイトを購読することができなくなり、WordPressのSEOに悪影響を与える可能性があります。

Disable RSS feeds

一方、他のタイプのRSSフィードを無効化することもできます。

例えば、投稿者、検索、添付ファイル、タクソノミーなどのRSSフィードをオフにすることができます。

Save changes to RSS feed

完了したら「変更を保存」ボタンをクリックするのをお忘れなく。

方法2:WordPressのRSSフィードを手動で無効化する

WordPressでRSSフィードを無効化するもう一つの方法は、テーマのfunctions.phpファイルにコードを追加することです。

上級ユーザーでない限り、functions.phpファイルそのものを編集することはお勧めしません。そのため、WPCodeを使用してWordPressにスニペットを貼り付けることをお勧めします。

まず、無料のWPCodeプラグインをインストールする必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

アクティベート後、WordPressダッシュボードでCode Snippets “ Add Snippetを検索してください。その後、検索バーに「rss」と入力するだけで、WPCodeライブラリの設定済みスニペットを見つけることができます。

右側に表示される「Disable RSS Feeds」の項目にマウスオーバーし、「Use snippet」ボタンをクリックするだけです。

Use WPCode to Disable RSS feeds

次のページでは、次のスニペットが表示されます。WPCodeがすでにすべてのオプションを設定していることに注目してください。プリセット・スニペットを使えば、何もカスタマイズする必要はありません。

上級ユーザーであれば、これを自分のfunctions.phpファイルにコピー&ペーストすることもできます:

/**
 * Display a custom message instead of the RSS Feeds.
 *
 * @return void
 */
function wpcode_snippet_disable_feed() {
	wp_die(
		sprintf(
			// Translators: Placeholders for the homepage link.
			esc_html__( 'No feed available, please visit our %1$shomepage%2$s!' ),
			' <a href="' . esc_url( home_url( '/' ) ) . '">',
			'</a>'
		)
	);
}

// Replace all feeds with the message above.
add_action( 'do_feed_rdf', 'wpcode_snippet_disable_feed', 1 );
add_action( 'do_feed_rss', 'wpcode_snippet_disable_feed', 1 );
add_action( 'do_feed_rss2', 'wpcode_snippet_disable_feed', 1 );
add_action( 'do_feed_atom', 'wpcode_snippet_disable_feed', 1 );
add_action( 'do_feed_rss2_comments', 'wpcode_snippet_disable_feed', 1 );
add_action( 'do_feed_atom_comments', 'wpcode_snippet_disable_feed', 1 );
// Remove links to feed from the header.
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );

もし必要であれば、プレースホルダーのテキストをカスタムメッセージに変更することもできますが、これは完全にオプションです。

The WPCode snippet to Disable RSS feeds

あとは、「有効化」スイッチをオンにして、「更新」をクリックするだけです。今後、RSSフィードは無効化されます。

WordPressでRSSフィードを無効化する方法について、この投稿がお役に立てば幸いです。WordPressのよくあるエラーとその修正方法のリストや、WordPressを使ってポッドキャストを始める方法のガイドもご覧ください。

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

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

  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. Mrteesurez says

    This is helpful.
    It’s also recommended for eCommerce or eLearning stores that don’t have posts, nice article.

    But the method of using WPcode didn’t disable the RSS for particular page or taxonomy. It disable them all and replace with custom message.

    How can I only select or adjust to only disable RSS on specific post, taxonomy or post type ??

  3. frank says

    The code has priority 1 in several lines but the wp code plugin as well as the t code fragment and places priority 10 for all the code in general, is it necessary to change it to priority 1 as well? or does it make no difference?

    • WPBeginner Support says

      It should not be required but should you have any trouble you can feel free to change the priority of the snippet from the plugin :)

      管理者

  4. Vishal says

    Hi.. Team
    Helpfull Article
    after installing the RSS feed disabled plugin, Whether or not articles will appear in Google News

      • Vishal says

        I do not want anyone to take the content of the website from the RSS feed. I want to stop the RSS feed for the third party website.

        My website is also in Google News. I want to give my RSS feed To Google News. But not other third Party websites.

        Please Guide me How to Stop RSS Feed For 3rd party Websites

        • WPBeginner Support says

          We do not have a recommended method for that kind of limitation at the moment.

  5. Tobias Hyldeborg says

    After having pasted the code in my functions.php, nothing happens. I still get a page saying “You do not have an RSS reader installed”. Are there other ways to remove the RSS feed, I am trying to minimize the use of plugins on my site.

    • WPBeginner Support says

      You may want to ensure you cleared any caching in your browser/hosting provider to ensure you’re not viewing a cached page.

      管理者

  6. Mike Mahaffey says

    HI

    Can you tell me about WordPress adding “feed” to the end of some of my urls that show up as 404 errors?

    /what-to-make-a-website-aboutfeed

    I’ve been redirecting them but don’t know whether that’s necessary or not?

    Does this even have anything to do with RSS? And do you know how to stop it from happening?

    Thanks for your website, I don’t know where I would be without it.

  7. james says

    after disabling feed annd removing link rel of feed in my view source ive set an 500 response code in my google webmaster,,

  8. sumit says

    thant a great artical some one are feeded my artical then with your help i disabled my sited feed thanks you very much.

  9. wazomba says

    I fisrt used to plugin to disable RSS feed. But the RSS link still appeared on BP Wall, so I simply add a css trick in me theme style file : .feed{display:none;}. Done!

  10. Annn says

    Does removing RSS access have any effect on rankings?
    or does this simply prevent people taking content via rss methods…

    Thanks

    • Mia Rhode says

      Does temporarily disabling my RSS feed delete my database of current subscribers? I am trying to post an article and backdate it, so I don’t want it to be sent out via RSS.

  11. Jhonatan says

    The function is pretty neat and helpful.

    The function does not allow WordPress to add any information to the RSS .php files.. instead it re-writes it.

    I advise anyone to install the plugin and to add the function into functions.php of your theme file.

    The plugin removes the generate HTML source code, you will get rid of 2 useless lines.

  12. Tim G. says

    Thanks for sharing this! It worked great with one exception: when I add ‘/?feed’ to the end of the root domain, it is still calling a listing page showing the posts that I am trying to make inaccessible via the built-in feeds.

    I’ve tried refreshing my permalinks but that didn’t make a difference. Is there some other rule I need to add to the functions file (in a child theme in case that matters, btw) to address this, or maybe I can disallow it from the .htaccess file?

  13. Debbie says

    My comments get published as posts which end up in my main RSS feed. Any idea on how to fix this? Ive read it may be a setting but so far we cant find it.

  14. nacho says

    Hi there! nice post!!!

    I love the functions.php code, but I’m using buddypress and the code dont disable the activity feed, someting like:

    How could I disable this?

    Thanks in advanced and regards from Spain.

返信を残す

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