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のバージョン番号をサイトから削除したいですか?

WPBeginnerでは、多くのサイトのWordPressセキュリティ向上を支援してきました。WordPressのバージョン番号をサイトのソースコードに残しておくと、一般的なオンライン攻撃に対して脆弱になる可能性があります。

この投稿では、WordPressのバージョン番号を簡単に削除する正しい方法を紹介し、潜在的な脅威からサイトを守るお手伝いをします。

Hiding WordPress version number from your website

なぜWordPressのバージョン番号を削除するのか?

WordPressのバージョン番号をサイトのソースコードに表示したままにしておくと、ハッカーの標的になりやすくなります。この些細なことが、特定のバージョンに関連する脆弱性にサイトをさらすことになり、攻撃者が既知の問題を悪用することを容易にします。

初期設定では、WordPressはトラッキングのためにサイトに足跡を残します。これが、WordPressが世界トップのサイトビルダーであることの証明です。

WordPress version shown in source code by default

しかし、WordPressの最新バージョンを実行していない場合、この足跡がサイトのセキュリティ・リークになることがあります。この足跡は、ハッカーにあなたがどのバージョンを実行しているかを伝えることで、有益な情報を提供します。

ハッカーはしばしば、特定のソフトウェア・バージョンの既知のセキュリティ脆弱性を狙います。WordPressのバージョン番号を非表示にすることで、あなたのサイトがどのバージョンのWordPressを使用しているかを攻撃者が特定することを少し難しくします。

すべてのサイトでWordPressの最新バージョンを使用することをお勧めします。ただし、古いバージョンのWordPressを使用している場合は、このチュートリアルに従ってください。

サイトで使用しているWordPressのバージョンの痕跡をすべて消すのはかなり困難です。巧妙な攻撃であれば、まだその情報を見つけることができるかもしれません。

しかし、自動スキャナーや他のあまり洗練されていない試みがWordPressのバージョンを推測するのを防ぐことができます。

そこで、WordPressサイトからバージョン番号を簡単に削除する方法をいくつかご紹介しましょう。

方法1.WordPressのバージョン情報をコードで削除する(推奨)

この方法では、WordPressサイトにコードを追加する必要があります。WordPressでコードスニペットをコピー&ペーストする方法をご覧ください。

さて、多くのサイトでは、テーマのheader.phpファイルを編集し、以下の行を削除することを勧めている:

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />

新しいテーマの更新は古いテンプレートを新しいファイルで自動的に置き換えるので、この方法は機能しません。

一般的に推奨されているが非効率的なもう一つの方法は、テーマのfunctions.phpにこのコードを記述することである:

remove_action('wp_head', 'wp_generator');

これはWordPressのヘッダーから情報を削除するだけです。バージョン番号はサイトのRSSフィードに表示されます。

WordPressのバージョン情報を削除する正しい方法は、バージョン情報を表示する機能を無効化することです。

ヘッダーファイルとRSSフィードの両方からWordPressのバージョン番号を完全に削除するには、コードスニペットプラグインに以下のコードを追加する必要があります。

function wpbeginner_remove_version() {
return '';
}
add_filter('the_generator', 'wpbeginner_remove_version');

さらに簡単にするには、WordPressに最適なコード・スニペット・プラグインであるWPCodeを使うことができる。

WPCodeは、WordPressのバージョン番号を削除するためのスニペットを含む、最も一般的なWordPressのコードスニペットをすべて持っているビルトインコードライブラリを持っています。

開始するには、無料のWPCodeプラグインをインストールし、有効化する必要があります。ステップバイステップの手順については、WordPressプラグインのインストール方法をご覧ください。

wpcode plugin

プラグインを有効化したら、WordPressダッシュボードからCode Snippets Libraryにアクセスしてください。

次に、「Remove WordPress Version Number」スニペットを検索し、「Use snippet」ボタンをクリックします。

Select the Remove WordPress Version Number snippet in WPCode

WPCodeは自動的にコードを追加し、コードのタイトルを追加し、正しい挿入方法を設定します。

タグを追加して整理することもできる。

WPCode Remove WordPress Version code snippet

必要なのは、トグルを「無効」から「有効」に切り替えることだけだ。

そして「更新」ボタンをクリックする。

Switch the code snippet to Active and click Update in WPCode

これで、WordPressのバージョン番号はサイトのフロントエンドやRSSフィードから非表示になります。

方法2.Sucuriを使用してWordPressのバージョン番号を削除する。

WordPressのトップセキュリティプラグインはすべて、設定でWordPressのバージョン番号を非表示にするオプションを提供しています。

しかし、WordPressのバージョン情報を自動的に非表示にし、より高度なセキュリティ機能を提供するSucuriを使用することをお勧めします。

Is Sucuri the right WordPress security plugin for you?

その上、SucuriはHTTPトラフィックをフィルターして監視し、悪意のある脅威がWebサーバーに到達する前にブロックするファイアウォールを提供します。悪意のあるコードが検出された場合は、サイトをクリーンアップし、その過程で脅威を取り除くことができます。

Sucuriプラグインをインストールして有効化するだけです。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

有効化したプラグインは、WordPressのバージョン情報を自動的に非表示にします。Sucuri Security ” Settingsにアクセスし、Hardeningタブに切り替えることで確認できます。

Sucuri WordPress version hardening

WPBeginnerでWordPressのセキュリティを向上させるためにSucuriを使用している理由についての 投稿にも興味があるかもしれません。

WordPressのバージョンを完全に非表示にできるか?

WordPressは、サイト内の他のさまざまな場所にバージョン情報を追加することができます。

例えば、CSSやJSファイルのソースコードにクエリー文字列として含まれる。

WordPress version shown with CSS and JS files

WordPressのバージョン情報をすべて削除するのは時間がかかり、複雑で、必ずしもうまくいくとは限りません。

セキュリティの観点からは、明らかなジェネレータタグを削除することで、非常に一般的な攻撃から身を守ることができる。

しかし、あなたのサイトに侵入しようとする者がいる場合、WordPressのバージョン番号を非表示にしても、それを阻止することはほとんどできません。

あなたのサイトをより安全にするために、適切なWordPressのセキュリティ設定を実装する必要があります。これにより、サイトの周囲にセキュリティの層ができ、ハッキングされにくくなります。

そして、安全でないウェブホスティングはハッキングの試みを受けやすいので、あなたのサイトに最適なWordPressホスティングサービスを選択したい。

この投稿で、WordPressのバージョン番号をサイトから簡単に非表示にする方法をご理解いただけたでしょうか。あなたのサイトに無料のSSL証明書を取得する方法についてのガイド、または中小企業に必須の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

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

  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. Jiří Vaněk says

    Sometimes it fascinates me how many details can be done, e.g. in terms of security, that I would not have thought of. So I removed the WordPress version from the website according to your instructions.

  3. Ashkan says

    function wpbeginner_remove_version()
    what should we write instead of “wpbeginner” _remove_version?
    a specific file name or our website name or what?

    • WPBeginner Support says

      This is to remove the version number from the HTML header, if you want to remove the text that you are using WordPress then you would want to reach out to your specific theme’s support.

      管理者

  4. Abhishek says

    i have added this line in functions.php, but wapplyzer can still detect the version
    remove_action(‘wp_head’, ‘wp_generator’);

  5. bayu says

    hy.. a practice that is still usable ? I want to ask, how to hide the plugin that we use information from view page source and various wordpress detector … thanks alot.

  6. Ragoco says

    Will this prevent WordPress from auto-detect and notify me about new versions, so that i can update? Thanks

  7. Chris Copland says

    For those like me who have read this to the bottom looking for a definitive answer only to be left wanting despite all the possibilities no one has Identified a solution that works for everyone.

    I suggest you load WordPress in Wamp or similar and check every possibility.

    How about the editorial staff have a look remove…remove the wheat from the chaff and re-post
    The Right Way To Remove WordPress Version Number?

  8. nicmare says

    why so complicated? make it easy:
    // remove wp version
    add_filter(‘the_generator’, ‘__return_false’);

  9. Dan says

    Maybe I’m missing something here, but adding the filter does remove the version number but fails to remove it from the end of some of the styles sheets and a few .js files as well from plugins. i.e.

    ….css?ver=3.8.1′ type=’text/css’ media=’all’ />

    Anyway to remove those as well?

    Thanks

  10. Alys says

    Hi

    none of these methods work with WP 3.8/ RC2

    I put the code:

    function wpbeginner_remove_version() {
    return ”;
    }
    add_filter(‘the_generator’, ‘wpbeginner_remove_version’);

    in the bottom of my functions.php file. No effect.

    Here is a sample of the scripts loading when I look at the source code, and you can see the wp ver is still tacked onto the end….

    I tried some of the other code suggestions in this thread, and none of them worked either.

    Perhaps I am doing something wrong?

    Many thank in advance for your suggestions.

    As you can see it is still showing at the end of each.

  11. Dave says

    It should also be mentioned that if you want to hide the number, you should also get rid of the readme.html file that accompanies WordPress, as it displays the version in big giant numbers right at the top of the page. Last I read, it also hides in a JavaScript file somewhere as well, but I’m not sure which one.

  12. Jeremy Simkins says

    I use this to remove the WordPress version.

    ‘remove_action(‘wp_head’, ‘wp_generator’); // Remove WordPress version from site’

  13. Matthew Shuey says

    This is arguably on of the most useful code snippets ever. Plugins break so this is a perfect way to remove the generator meta tag from WordPress.

  14. techispot says

    Sorry to say it is not working with feed, I means it not remove version number from feed, I personally add the function you specified , it remove from my home page source but not from rss page source, you can view my rss page source it is still there http://www.techispot.com/feed

    Any one find solution please share

  15. brasofilo says

    i wanted to keep the generator without the version number, so i’m returning instead of an empty string…

    is this correct?

  16. Nacin says

    Removing the generator code has nothing to do with security, frankly. If someone is targeting your site in particular, there are other effective ways to determine a version number. If it’s just a malicious script, it’s going to try every exploit that has ever worked regardless of your version. Indeed, we have never seen an exploit script attempting to do version detection.

    Also, the statement “While plugins are great, they somewhat slow your site down,” is a bit misleading in this context, I feel. Yes, a lot of plugins that do heavy-lifting will increase drag on a server. But a good amount of core uses the Plugin API to hook into itself, using the same methods as a plugin. And adding this code to functions.php is doing the same thing.

    • Roger Ruz says

      “Also, the statement “While plugins are great, they somewhat slow your site down,” is a bit misleading in this context, I feel. ”

      Nice argument! I’m researching on how to remove plugin scripts that are not necessary/not in use to a page but being requested every time in the server.

  17. Ray says

    Realized that the “Secure WordPress” plugin already does that for you and more. Assuming most people would be interested in securing their WordPress (not just hiding the version number), it would be better to make use of that plugin to do all these for you.

    Incidentally, I got to know of the Secure WordPress plugin via wpbeginner. https://www.wpbeginner.com/wp-tutorials/11-vital-tips-and-hacks-to-protect-your-wordpress-admin-area/

    Nice work guys! Keep on writing!

    • Editorial Staff says

      While plugins are great, they somewhat slow your site down. Why use a plugin if it can be done with a simple function in your functions.php file. But yes Secure WordPress plugin does that as well on all versions older than 2.4.

      管理者

      • Ray says

        Would have to agree with you on that: just modding the functions.php would be more efficient than adding a plugin just to remove the version number.

      • Nick says

        Ok the error was mine, I was modifying the wrong function.php file.
        The correct one is function.php inside the theme directory and not the one in the core.

        Thank you!!!

  18. Nick says

    It’s strange, it gives me the error:
    Call to undefined function: add_filter()

    But I’ve checked the plugin.php file and I have obviously the add_filter() funciont defined.

    Any suggestion? Ths.

返信を残す

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