public
Created

Delete .htaccess per plugin

  • Download Gist
delete-htaccess.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
<?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__ ) );
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.