WordPress prompt checklist before publish?

Create new plugin and add this as your the content:

<?php
/*
Plugin Name: [CR]TestDropIn
Plugin URI: http://bayu.freelancer.web.id/
Description: A barebone plugin to test whatever wordpress API you want to test
Author: Arief Bayu Purwanto
Version: 0.0.1
Author URI: http://bayu.freelancer.web.id
*/



add_action('admin_head', 'xxx_admin_hook');

function xxx_admin_hook(){
?>
<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
    jQuery('#post').submit(function() {
        //alert('Handler for .submit() called.');
        //return false;
        var cfm = confirm("Do you have a title?\n" + 
"Is the article complete?\n" + 
"Spell checked?\n" + 
"Did you pick tags?\n" + 
"Have you selected a category?\n" + 
"Choose a featured image?", "Check your content");
        if(cfm)
        {
            return true;
        }
    jQuery('#ajax-loading').hide();
    jQuery('#publish').removeClass('button-primary-disabled');

        return false;
    });
});
</script>
<?php
}

Note:

  • It has bug as it doesn’t cancel the loading icon. Nothing big if you don’t really care that, as it doesn’t interfere the process nor does it break the wordpress. It just doesn’t that good to see.bug fixed!

  • Plugin published here (while waiting approval for plugin repository).

Leave a Comment