Delete .htaccess per plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: Delete .htaccess | |
* Description: Deletes the .htaccess file on activation, deactivates itself then. | |
* Plugin URI: http://wordpress.stackexchange.com/q/58183/73 | |
* Version: 2012.07 | |
* Author: Thomas Scholz | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
* | |
* Delete .htaccess, Copyright (C) 2012 Thomas Scholz | |
*/ | |
register_activation_hook( __FILE__, 'wpse_58183_delete_htaccess' ); | |
add_action( 'admin_notices', 'wpse_58183_admin_notice' ); | |
function wpse_58183_delete_htaccess() | |
{ | |
$root = trailingslashit( $_SERVER['DOCUMENT_ROOT'] ); | |
unlink( $root . '.htaccess' ); | |
} | |
function wpse_58183_admin_notice() | |
{ | |
echo '<div class="updated"><p><code>.htaccess</code> deleted.<br>Plugin deactivated.</p></div>'; | |
deactivate_plugins( basename( __FILE__ ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download as ZIP file from http://f.toscho.de/delete-htaccess.zip.