Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » WordPress / WordPress Snippets » Add Confirmation Message Before Publishing A Post In WordPress

Add Confirmation Message Before Publishing A Post In WordPress

We all bloggers are fairly enthusiastic and so want to publish as many articles as you can and at the earliest opportunity. There comes the situation: at one period or other we’re able to have accidentally constrained the “Publish” key and caused this content to go reside even before it really is completed.

If you’ve pressed the Distribute button accidentally, it may scare you as the article or the post is just not yet completed or maybe you haven’t critique it yet or maybe the article is to be scheduled on an upcoming date, etc. Furthermore, by the time you are aware of and unpublished this content, the post could have already appeared on social websites, or it could be sent to your own email subscribers, or in your worst case predicament your readers may perhaps comment or send emails requesting what it is that you have written.

To provide a custom message before publishing the post in WordPress, you can follow any one of the two methods proven below, e. g. using a free of charge WordPress plugin (easy way) or maybe by manually adding a piece of code (smart way).

Table of Contents

How To Add Confirmation Message Before Publishing A Post In WordPress Without Plugin?

Step 1:) Copy the below code and Paste in your Theme Function(function.php) file.

/* ------------------------------------------------------------------------- *
 * Add Confirmation Message On "Publish" Button
/* ------------------------------------------------------------------------- */
$confirmation_message = 'Are You Sure Want To Publish/Update This Post Right Now?'; 
function confirm_message_publish(){
 global $confirmation_message;
 echo '
<script type="text/javascript"><!--
var publish = document.getElementById("publish");
if (publish !== null) publish.onclick = function(){
 return confirm("'.$confirmation_message.'");
// --></script>';
add_action('admin_footer', 'confirm_message_publish');

Step 2:) Save And That’s It.


To display different text change the word ‘Are You Sure Want To Publish/Update This Post Right Now?‘ only.

Theme Files Editing Warning:

Keep in mind that every code that you will add in your themes files will be removed when you will change the theme. So after changing your theme, you have to follow this article again and you will get everything back same as it is now.

Last Words:

This is what we have and shared in easy steps for newbies so that they can easily know how it works. Stay with us because we are going to share a whole guide step by step about WordPress and make it easy for you. If you liked it then share it and be with us to get next tutorial. If you have any problem then feel free to ask us. We will help you with what we can or have.

Recommended For You:
10 Useful WordPress Conditional Tags For Template Designers

You Like It, Please Share This Recipe With Your Friends Using...

6 Responses to “Add Confirmation Message Before Publishing A Post In WordPress”

  1. Bechdaalo says:

    I really enjoyed reading this article. Keep sharing your knowledge with such informative and engaging article.

  2. Martin McAlister says:

    Thanks for sharing, now i have no problems with article confirmation.
    Great job , please continue sharing your ideas and results !

  3. Steroids Fax says:

    Quite useful info, but maybe this function is fixed in new version of wordpress?

    • EXEIdeas says:

      Welcome here and thanks for reading our article and sharing your view. You can make a custom message popup through this or can hack any thing in it.

Leave a Reply

Your email address will not be published. Required fields are marked *