jeudi 17 mars 2016

Want to call a java script on deactivation of wordpress plugin

I want to call a js file which have a ready function to call my api. My Code is..

<?php
.
. // rest all code.................................
.
.

/* Runs on plugin deactivation*/
register_deactivation_hook( __FILE__, 'Pushbiz_remove' );

function Pushbiz_remove() {
/* Deletes the database field */

delete_option('PushBIZ_firstCreation');
delete_option('VarPushBIZapikey');
delete_option('PushBIZRegUrl');
?>
<form id="DeactivationForm" role="form">
<input type="hidden" value="<?php echo $api=get_option( 'VarPushBIZapikey');?>" id="regapikey">
<input type="hidden" value="<?php echo $api=get_option( 'RegUrlofapi');?>" id="RegUrl">
</form>
<?php
wp_register_script( 'DeactivationJS', plugins_url( '/admin/js/deactivation.js', __FILE__ ));
wp_enqueue_script( 'DeactivationJS' );

}
?>

I am unable to call deactivation.js on on the deactivation of plugin. How can i call this java script on the event of deactivation.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire