Skip to content

Instantly share code, notes, and snippets.

@aaronjorbin
Last active August 29, 2015 14:19
Show Gist options
  • Save aaronjorbin/5644934946c05ad08b9c to your computer and use it in GitHub Desktop.
Save aaronjorbin/5644934946c05ad08b9c to your computer and use it in GitHub Desktop.
jQuery( window ).off( 'beforeunload', wp.updates.beforeunload );
jQuery( window ).on( 'beforeunload', function(){
return 'always prompt'
});
~
~
~
~
~
<?php
/*
Plugin Name: Replace wp-plugin beforeunload
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, It is a pipe
Author: Aaron Jorbin
Version: 0.1
Author URI: http://aaron.jorb.in
*/
function jorbin_beforeunload_add_admin_scripts( $hook ) {
if ( $hook == 'plugins.php' || $hook == 'plugins-install.php' ) {
wp_enqueue_script( 'myscript', plugins_url( 'js.js', __FILE__ ), array( 'updates' ) );
}
}
add_action( 'admin_enqueue_scripts', 'jorbin_beforeunload_add_admin_scripts', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment