Created
October 22, 2010 18:29
-
-
Save mjangda/641110 to your computer and use it in GitHub Desktop.
WordPress confirm on publish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Confirm On Publish | |
Description: Prompts you to confirm if you want to publish or update a post | |
*/ | |
add_action( 'load-post.php', 'x_confirm_before_publish' ); | |
function x_confirm_before_publish() { | |
?> | |
<script> | |
;(function($) { | |
// Not quite perfect because it triggers the auto-save and the loady spinny doesn't go away after if you cancel | |
jQuery(document).ready(function() { | |
jQuery('#publish').click(function(e) { | |
if(!confirm('Are you sure you want to publish this?')) return false; | |
}); | |
}); | |
})(jQuery); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My version (just the JS) that I wrote a few months back, which also hides the throbber: