Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created July 11, 2012 18:29
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thefuxia/3092193 to your computer and use it in GitHub Desktop.
Delete .htaccess per plugin
<?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__ ) );
}
@thefuxia
Copy link
Author

Download as ZIP file from http://f.toscho.de/delete-htaccess.zip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment