A very common issue that I experience with new authors is that they forget to complete a few essential tasks prior to submitting their post for review (even though I have a guide available for them).

Is it possible to add a confirmation box that appear only when a contributor clicks on the "Submit for Review" button? Potentially a jQuery box like this:

enter image description here

I have come across a few confirm publish codes on the web and plugin archives but all of which trigger on Publish (not Submit for Review) and prompts a Javascript alert window.

2 Answers 2


A useful fast way is to use JavaScript in combination with an Ajax action that outputs the box.

Create a small plugin. Create a folder inside plugins directory, naming it 'SubmitReviewConf'. In this folder create a PHP file named SubmitReviewConf.php.

In this file, put this code:

* Plugin Name: Submit for Review Confirmation Message
* Description: Confirmation Message for Submit for Review Action
* Author: G.M.

function add_my_admin_assets( $hook ) {
    // Only once variable force the box to be shown only one time. Can be from theme or plugin via filter.
    // Default is true
    $only_once = apply_filters( 'submit_review_conf_onlyonce', 1 );
    if ( $only_once && $hook == 'post.php' ) $post = get_post( $_GET['post'] );
    $enqueue = $only_once ? ($hook == 'post-new.php' || ( $hook == 'post.php' && $post->post_status != 'pending') ) : ($hook == 'post-new.php' || $hook == 'post.php');
    if ( isset($post) && get_post_meta( $post->ID, '_skip_SubmitReviewConf', true ) ) return;
    $postid = '';
    if ( isset($_GET['post']) && is_object($post) ) $postid = $post->ID;
    if ( $enqueue && ! current_user_can( 'edit_published_posts' ) ) {
        wp_enqueue_style( 'thickbox' );
        wp_enqueue_script( 'SubmitReviewConf', plugins_url( 'SubmitReviewConf.js', __FILE__ ), array( 'jquery','thickbox' ), null );
        wp_localize_script( 'SubmitReviewConf', 'SubmitReviewConfData', array( 'only_once' => $only_once, 'postid' => $postid ) );
add_action( 'admin_enqueue_scripts', 'add_my_admin_assets', 30 );

function clean_up_SubmitReviewConf_meta( $post ) {
     delete_post_meta( $post->ID, '_skip_SubmitReviewConf' );
add_action( 'pending_to_publish', 'clean_up_SubmitReviewConf_meta', 30 );      

function confirmation_msg_out() {
    if ( isset( $_GET['only_once'] ) && isset( $_GET['postid'] ) ) update_post_meta( $_GET['postid'], '_skip_SubmitReviewConf', '1' );
    <div id="confirmation_msg_out">
            <li><?php _e('Did you ... '); ?></li>
            <li><?php _e('Did you ... '); ?></li>
            <li><?php _e('Did you ... '); ?></li>
        <input id="confirmation_msg_submit" class="button button-primary button-large" value="<?php _e('Submit for Review') ?>" name="submitforreview"></input>
        <a id="confirmation_msg_submit_cancel" class="button button-large" href="#"><?php _e('Cancel') ?></a>
add_action( 'wp_ajax_output_review_confirm', 'confirmation_msg_out' );

This small plugin contains only 2 functions. ( Edit: after an OP request in comments, it became 3)

The first enqueues a custom script (what is it is explained later) and the 'thickbox' script (the script WordPress uses to show modal messages).

These scripts are enqueued only if current user cannot edit published posts, so authors and higher users can publish posts with no confirmation message.

The second function outputs the HTML for the confirmation box. This function is hooked into an Ajax action, output_review_confirm.

Now in the same folder of PHP files let's create our JavaScript file and name it SubmitReviewConf.js.

In this file put:

jQuery().ready( function($) {

    var $publish = $('#publish');

    var only_once = SubmitReviewConfData.only_once;

    function remove_confirm_publish_button() {

    $(document).on('click', '#confirm-publish-button', function(e) {
        if ( only_once ) remove_confirm_publish_button();
        var tb_show_url = ajaxurl + '?action=output_review_confirm';
        if (only_once) tb_show_url += "&only_once=1";
        if ( SubmitReviewConfData.postid != '' ) tb_show_url += "&postid=" + 
        tb_show('', tb_show_url);

    $(document).on('click', '#confirmation_msg_submit', function(e) {

    $(document).on('click', '#confirmation_msg_submit_cancel', function(e) {

    var newbutton = '<input id="confirm-publish-button" class="button button-primary button-large" type="button" value="' + 
        $publish.val() + '"></input>';


What this script does:

  1. Hides the WordPress 'Submit for Review' button and replaces it with a button that appears equal to the WP one, but that does not trigger the submit action.
  2. When our fake submit button is clicked, we use the Ajax URL to trigger our function and output the HTML inside the modal confirmation, using the tb_show function provided by the ThickBox script.
  3. When the user clicks 'Submit for Review' inside the modal box, we simulate a click on the WP standard 'Submit for Review' button and remove the modal window. If the user clicks on 'Cancel' we simply remove the modal window, doing nothing.

That's all. Remember to activate the plugin in WP backend ;)

Note that this plugin requires JavaScript to be enabled on user browser. If disabled the user will not see any confirmation, but consider that modal window (ThickBox) is a JavaScript script that cannot work if JavaScript is disabled.

If this feature was a critical one, you'd probably want to disable publishing if JavaScript is disabled, but being a not-critical feature, you can just ignore users that have JavaScript disabled (WordPress will take care for your security, in that case) considering they are a very small percentage of users.

  • Before I praise you for this solution, let us make it work accordingly. Currently upon plugin activation, this error appears: Parse error: syntax error, unexpected '}' in /SubmitReviewConf/SubmitReviewConf.php on line 30
    – Christine Cooper
    Aug 28, 2013 at 15:51
  • Sworn that I did that, at least when I pasted it in phpStorm. Nonetheless, this is a stellar answer and works very elegantly. Very well done! I will leave the question open for a few days so the answer receives more attention (upvotes) which I certainly believe that it deserves. With that being said, I do have a final question. Like many other multi-author platforms, I use WyPiekacz wordpress.org/plugins/wypiekacz which is a plugin where you can set conditions that users need to follow when posting.
    – Christine Cooper
    Aug 29, 2013 at 14:07
  • Problem is that the broken rule notification appears after the thickbox appears. Making this a very painful task if the user have to see the thickbox several times- which could potentially make this an annoyance rather than a benefit. Is there any way to enforce these rules first and when they are passed, then display the thickbox?
    – Christine Cooper
    Aug 29, 2013 at 14:08
  • @ChristineCooper The problem is that your plugin check rules on wp_insert_post_data filter. So if post pass rules, post is saved very soon, and I think there is no chance to show the modal box before post is saved as 'pending'... An easy edit I can make to my plugin is to force modal box appear only one time, but still before rules are passed or after post is already sended for review.
    – gmazzap
    Aug 29, 2013 at 15:20
  • 1
    @ChristineCooper "Do you have a fix for this?" Is this a challenge? ;D Solve bug was very easy for itself, problem is compatibility with WyPiekacz. Only for that I have to implement additional code handling a meta field. Btw now bug should be fixed in WyPiekacz compatible way. Only check this workflow: (I haven't WyPiekacz to test): create and save post as draft. After saved change it in a way that make WyPiekacz rules fail. Send for review, modal should appear. In modal click 'Submit' this will trigger WyPiekacz error. Correct it and send for review again. Does modal appear again?
    – gmazzap
    Aug 30, 2013 at 18:13

It is possible to do so. You have to use the wp_insert_post_data filter hook. I will give you the general idea, hopefully this helps.

An example would be:

function my_filter_handler($data , $postarr) {
    // do something with the post data

    // You have to check that your post is submitted for review, not the publish post, so you have to have an if statement checking that

    // Then, you have to ensure that you use jQuery that comes with WordPress (using enqueue methods), and not a jQuery you supply.

    return $data;

add_filter('wp_insert_post_data', 'my_filter_handler', '99', 2 );
  • By the way, another approach would be to use the 'save_post' action hook instead of the wp_insert_post_data filter hook. Just so you have different ideas.
    – Greeso
    Aug 12, 2013 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.