WordPress Remove the WP version number in the Feed step

Source: Internet
Author: User
Tags wordpress version
The use of WordPress bloggers are generally still very safe awareness, is to remove the version of WordPress, so that bad intentions of people using the old version of the vulnerability of the site attack. (Free worpress template download)

WordPress will add the following code to the front-end code head:

<meta name= "generator" content= "WordPress 4.7.3"/>

After the use of the method is removed, but the WordPress feed will still exist a:

<generator>https://wordpress.org/?v=4.7.3</generator>

The above 4.7.3 is the version number of WordPress, in fact, there are many ways to remove WordPress added version number information, then today's PHP Chinese network needs to share a nearly perfect solution, first we look at several common ways:

Method One: Delete the Wp_head () directly in header.php

Generally in accordance with the WordPress specification development of the theme file header.php will use the Wp_head () function, where the code at the beginning of this article is through the Wp_head () function output, and this function will output some useless code, so some people simply come to a happy, Delete the Wp_head () function directly.

But they just didn't think that a lot of plugins/themes would do something with this function, and deleting the function would make the plugins/themes work. Of course, if the pursuit of the ultimate or willing to toss friends, this is also a good way.

Method Two: Remove_action

WordPress has a very good development interface, almost all the functions of WordPress can be added and deleted in a similar way, which is also the majority of the tutorial provides a solution, where the son everywhere is easily picked up, Add the following code to the functions.php of the current topic:

   Remove_action (' Wp_head ', ' wp_generator ');

This allows you to remove the code that contains the version number from the head of the Web site that is mentioned at the beginning of this article.

You think you're done here? Nononono, you think you really put the site of the WordPress version number is completely hidden, open your feed source, such as HTTP//site address/feed, is not to see similar in the beginning of this article the second paragraph of code?

wordpress.org/?v=4.7.3

So how to remove WordPress in the Feed version number?

Perpetual method, add the following code to the current topic functions.php file:

Delete the WP version number add_filter (' The_generator ', ' fanly_remove_wp_version ') in the head and feed at the same time, function fanly_remove_wp_version () { Return ';}

To this point WordPress removal feed in the WP version number of the tutorial and method is declared to be over, if you have not noticed the feed, then you should look back now. Of course, if you also find other places leaked WordPress version number, also welcome the proposed we study together Kazakhstan.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.