Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Just a quick question that might help a tad bit with security. I noticed that the readme.html file has the version number listed. It reappears after each upgrade and so do the licence.txt, and wp-config-sample.php.

Is there a easy way to have WordPress auto remove these files after an upgrade?

I already block the version number from showing in the meta tags, rss feeds, atom, etc.

I know this type of security isn't exactly that much helpful, but just thought it might be a tiny start. I heard that people can simply check the version of jQuery that is included in WP-includes and cross reference which version of WP shipped it.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

You don't really need to remove these files. It's much easier to just block access to them. If you are using pretty URL's you already have an .htaccess file. Using .htaccess to block the files is secure and you only have to add a directive once.

Blocking files is done by adding a directive to .htaccess like this:

    <files filename.file-extension>
         order allow,deny
         deny from all
    </files>

So, to block readme.html you do this:

    <files readme.html>
         order allow,deny
         deny from all
    </files>

Do the same with the license file or any other file you want to prevent anyone from accessing. Just open .htaccess in Notepad or any other basic text editor, add the directives and save, making sure that the text editor keeps the file name exactly - without any .txt on the end.

share|improve this answer
    
This is actually the option I ended up going with. It works perfectly. –  Sahas Katta May 16 '11 at 4:49
add_action('core_upgrade_preamble','my_function_to_delete_files');

Edit : you can also try these

add_action('upgrader_pre_install','my_function_to_delete_files');
add_action('upgrader_post_install','my_function_to_delete_files');
share|improve this answer
    
Thanks, I figured out the php unlink feature and it works, but one issue. The hook you provided seems to execute by simply visiting the Updates section under Dashboard. Is there another hook for after the upgrade has occured? –  Sahas Katta Dec 15 '10 at 20:16
1  
ill take a look and let you know –  Atif Mohammed Ameenuddin Dec 16 '10 at 10:23
    
@Sahas @atif089 Did you manage to get this to work? –  INT May 12 '11 at 10:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.