Executing function on deactivation plugins

Just as there is an activation function, there is also a deactivation function. This is called the register_deactivation_hook() function. This function is triggered when your plugin is deactivated in the WordPress Plugins screen. This function accepts the same two parameters as the previous activation function.

<?php register_deactivation_hook( $file, $function ); ?>


1. $file – (string) (required) Path to the primary plugin file
2.$function – (string) (required) The function to be executed when the plugin is activated



Plugin Name: myPlugin
Plugin URI: your url address
Description: my first wordpress plugin
WordPress admin interface
Version: 1.0
Author: you name
Author URI:
License: GPLv2


function firstRunOnDeActivation()
	// any statements to delete files etc..