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

Właściwy sposób na usuwanie numeru wersji WordPressa

Uwaga redakcyjna: Otrzymujemy prowizję z linków partnerskich na WPBeginner. Prowizje nie mają wpływu na opinie i oceny naszych redaktorów. Dowiedz się więcej o Proces redakcyjny.

Czy chcesz usuwać numer wersji WordPress z twojej witryny internetowej?

W WPBeginner pomogliśmy wielu witrynom internetowym poprawić ich zabezpieczenia WordPress. Pozostawienie numeru wersji WordPress w kodzie źródłowym twojej witryny internetowej może sprawić, że będzie ona podatna na powszechne ataki online.

W tym artykule pokażemy ci właściwy sposób na łatwe usuwanie numeru wersji WordPressa, co pomoże ci zabezpieczyć twoją witrynę przed potencjalnymi zagrożeniami.

Hiding WordPress version number from your website

Dlaczego warto usuwać numer wersji WordPressa?

Pozostawienie numeru wersji WordPressa widocznego w kodzie źródłowym twojej witryny internetowej może uczynić ją łatwym celem dla hakerów. Ten drobny szczegół może narazić twoją witrynę na luki w zabezpieczeniach związane z tą konkretną wersją, ułatwiając atakującym wykorzystanie znanych problemów.

Domyślnie WordPress pozostawia swoje ślady na twojej witrynie w celu śledzenia. Dzięki temu wiemy, że WordPress jest najlepszym narzędziem do tworzenia witryn internetowych na świecie.

WordPress version shown in source code by default

Czasami jednak ten ślad może być źródłem wycieku zabezpieczeń na twojej witrynie, jeśli nie korzystasz z najnowszej wersji WordPressa. Dostarcza on hakerowi przydatnych informacji, informując go o używanej wersji.

Hakerzy często atakują znane luki w zabezpieczeniach określonych wersji oprogramowania. Ukrywając numer wersji WordPressa, utrudniasz atakującym ustalenie, która wersja WordPressa działa na twojej witrynie.

Zalecamy korzystanie z najnowszej wersji WordPress a na wszystkich twoich witrynach internetowych, więc nie musisz się o to martwić. Jeśli jednak korzystasz ze starszej wersji WordPressa, zdecydowanie powinieneś postępować zgodnie z tym poradnikiem.

Dość trudno jest usuwać wszelkie ślady tego, której wersji WordPressa używasz na swojej witrynie internetowej. Zaawansowany atak może nadal być w stanie znaleźć te informacje.

Uniemożliwi to jednak automatycznym skanerom i innym mniej wyrafinowanym próbom odgadnięcia twojej wersji WordPressa.

Biorąc to pod uwagę, przyjrzyjmy się kilku sposobom na łatwe usuwanie numeru wersji z twojej witryny internetowej WordPress.

Metoda 1. Usuwanie informacji o wersji WordPress za pomocą kodu (zalecane)

Ta metoda wymaga dodania kodu do twojej witryny internetowej WordPress. Jeśli nie robiłeś tego wcześniej, zapoznaj się z naszym przewodnikiem na temat kopiowania i wklejania fragmentów kodu w WordPress.

Wiele witryn internetowych zaleca edycję pliku header.php twojego motywu i pozbycie się następującej linii kodu:

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

Ta metoda nie działa, ponieważ nowa aktualizacja motywu automatycznie zastąpi stary szablon nowym plikiem.

Inną powszechnie zalecaną, ale nieefektywną metodą jest umieszczenie tego kodu w pliku functions.php twojego motywu:

remove_action('wp_head', 'wp_generator');

Spowoduje to jedynie usuwanie informacji z nagłówka WordPress. Numer wersji będzie nadal widoczny na kanałach RSS twojej witryny internetowej.

Właściwym sposobem na usuwanie informacji o wersji WordPressa jest wyłączenie funkcji odpowiedzialnej za ich wyświetlanie.

Aby całkowicie usuwać numer wersji WordPress zarówno z pliku nagłówkowego, jak i kanałów RSS, musisz dodać następujący kod do fragmentu kodu wtyczki.

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

Aby było to jeszcze łatwiejsze, możesz użyć WPCode, najlepszej wtyczki do fragmentów kodu dla WordPressa.

WPCode ma wbudowaną bibliotekę kodu, która zawiera wszystkie najpopularniejsze fragmenty kodu WordPressa, w tym fragment do usuwania numeru wersji WordPressa.

Aby rozpocząć, należy zainstalować i włączyć bezpłatną wtyczkę WPCode. Aby uzyskać instrukcje krok po kroku, zapoznaj się z naszym przewodnikiem na temat instalacji wtyczki WordPress.

wpcode plugin

Po włączeniu wtyczki, przejdź do Code Snippets Library z twojego kokpitu WordPress.

Następnie wyszukaj fragment kodu „Usuwanie numeru wersji WordPress” i kliknij przycisk „Użyj fragmentu kodu”.

Select the Remove WordPress Version Number snippet in WPCode

Następnie WPCode automatycznie doda kod, doda tytuł dla kodu, ustawi prawidłową metodę wstawienia.

Doda nawet tagi, które pomogą ci je uporządkować.

WPCode Remove WordPress Version code snippet

Wystarczy przełączyć przełącznik z „Nieaktywny” na „Aktywny”.

Następnie kliknij przycisk „Aktualizuj”.

Switch the code snippet to Active and click Update in WPCode

Teraz numer wersji WordPress będzie ukryty przed frontendem twojej witryny i kanałami RSS.

Metoda 2. Usuwanie numeru wersji WordPress za pomocą Sucuri

Wszystkie najlepsze wtyczki do zabezpieczeń WordPressa oferują w ustawieniach opcję ukrycia twojego numeru wersji WordPressa.

Zalecamy jednak korzystanie z Sucuri, ponieważ automatycznie ukrywa informacje o wersji WordPressa i oferuje inne, bardziej zaawansowane funkcje zabezpieczeń.

Is Sucuri the right WordPress security plugin for you?

Ponadto Sucuri zapewnia zaporę, która filtruje i monitoruje ruch HTTP, blokując złośliwe zagrożenia, zanim dotrą do twojego serwera WWW. Jeśli wykryje złośliwy kod, umożliwia oczyszczenie witryny internetowej, usuwając zagrożenia w trakcie procesu.

Wystarczy zainstalować i włączać wtyczkę Sucuri. Aby uzyskać więcej informacji, zobacz nasz przewodnik krok po kroku, jak zainstalować wtyczkę WordPress.

Po włączaniu wtyczka automatycznie ukryje informacje o wersji WordPressa. Można to zweryfikować przechodząc na Sucuri Security ” Settings i przechodząc na kartę Hardening.

Sucuri WordPress version hardening

Możesz być także zainteresowany naszym wpisem o tym, dlaczego używamy Sucuri do poprawy zabezpieczeń WordPress tutaj na WPBeginner.

Czy można całkowicie ukryć wersję WordPressa?

WordPress może nadal dodawać informacje o wersji w różnych innych miejscach w twojej witrynie internetowej.

Na przykład, jest on dołączany jako ciąg zapytania w kodzie źródłowym plików CSS i JS.

WordPress version shown with CSS and JS files

Usuwanie wszystkich instancji informacji o wersji WordPressa może być czasochłonne, skomplikowane i nie zawsze działać.

Z punktu widzenia zabezpieczeń, usuwanie oczywistych tagów generatora może zabezpieczyć przed niektórymi bardzo powszechnymi atakami.

Jeśli jednak ktoś jest zdeterminowany, by włamać się na twoją witrynę internetową, to ukrycie numeru wersji WordPressa w niewielkim stopniu to powstrzyma.

Musisz wdrożyć odpowiednią konfigurację zabezpieczeń WordPress, aby Twoja witryna internetowa była bezpieczniejsza. Dodaje to warstwy zabezpieczeń wokół twojej witryny internetowej, co utrudnia włamanie.

I chcesz wybrać najlepszego dostawcę hostingu WordPress dla twojej witryny internetowej, ponieważ niezabezpieczony hosting jest podatny na próby włamań.

Mamy nadzieję, że ten artykuł pomógł ci dowiedzieć się, jak łatwo ukryć numery wersji WordPress na twojej witrynie internetowej. Możesz również zapoznać się z naszym przewodnikiem na temat tego, jak uzyskać bezpłatny certyfikat SSL dla twojej witryny internetowej lub z naszą listą niezbędnych wtyczek WordPress dla małych firm.

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.

Ujawnienie: Nasze treści są wspierane przez czytelników. Oznacza to, że jeśli klikniesz na niektóre z naszych linków, możemy otrzymać prowizję. Zobacz jak WPBeginner jest finansowany, dlaczego to ma znaczenie i jak możesz nas wspierać. Oto nasz proces redakcyjny.

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.

Najlepszy zestaw narzędzi WordPress

Uzyskaj BEZPŁATNY dostęp do naszego zestawu narzędzi - zbiór produktów i zasobów związanych z WordPressem, które każdy profesjonalista powinien mieć!

Reader Interactions

65 komentarzyZostaw odpowiedź

  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.

      Administrator

  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. 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?

  7. nicmare says

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

  8. 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

  9. 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.

  10. 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.

  11. Jeremy Simkins says

    I use this to remove the WordPress version.

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

  12. 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.

  13. 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

  14. brasofilo says

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

    is this correct?

  15. 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.

  16. 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.

      Administrator

      • 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!!!

  17. 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.

Zostaw odpowiedź

Dziękujemy za pozostawienie komentarza. Pamiętaj, że wszystkie komentarze są moderowane zgodnie z naszymi polityka komentarzy, a Twój adres e-mail NIE zostanie opublikowany. NIE używaj słów kluczowych w polu nazwy. Przeprowadźmy osobistą i konstruktywną rozmowę.