Fact Maven Corp. on "Remove rules from .htaccess through a plugin"

ساخت وبلاگ

I've been able to add custom rules to my .htaccess through my plugin using the following function:

add_action( 'init', 'dsbl_htaccess' );
function dsbl_htaccess() { require_once( ABSPATH . '/wp-admin/includes/misc.php' ); $rules = array(); $rules[] = '<Files xmlrpc.php> # Disable XML-RPC'; $rules[] = 'Order allow,deny'; $rules[] = 'Deny from all'; $rules[] = '</Files>'; $rules[] = ''; $rules[] = '<Files wlwmanifest.xml> # Disable Windows Live Writer'; $rules[] = 'Order allow,deny'; $rules[] = 'Deny from all'; $rules[] = '</Files>'; $htaccess_file = ABSPATH . '.htaccess'; insert_with_markers( $htaccess_file, 'Fact Maven', ( array ) $rules ); }

As a result, the following is added to the .htaccess:

# BEGIN Fact Maven
<Files xmlrpc.php> # Disable XML-RPC
Order allow,deny
Deny from all
</Files>
<Files wlwmanifest.xml> # Disable Windows Live Writer
Order allow,deny
Deny from all
</Files>
# END Fact Maven

However, I'd like to know how I can have these rules removed once the the plugin is deactivated. After doing some research online, I'm aware that I would have to use the register_deactivation_hook hook which will run a function when I deactivate a plugin.

But after that I am still lost on trying to figure out where to go after that. If someone could provide me with some guidance, I would appreciate it.

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 264 تاريخ : يکشنبه 30 خرداد 1395 ساعت: 21:18