We bloggers are pretty enthusiastic and would love to publish as many articles as possible and as soon as possible. There comes the problem: at one time or other we could have accidentally pressed the “Publish” button and caused the article to go live even before it is completed.

If you have pressed the Publish button accidentally, it may scare you because the article or the post is not yet completed or you haven’t proofread it yet or the article is to be scheduled on a future date, etc. Moreover, by the time you realize and unpublish the article, the post may have already appeared on social media, or it may be sent to your email subscribers, or in the worst case scenario your readers may comment or send emails asking you what it is that you have written.

No matter what the reason for the accidental publication, it is really not a good experience for your users and your site. That said, you may also lose some points in SEO perspective. A good way to overcome this is to add a confirmation message before publishing a post or article in WordPress.

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

By Using a Free WordPress Plugin

The first method is probably the simplest way if you don’t want to mess with the code. To add a custom confirmation message before publishing a post, all you have to do is download and install a free plugin called Confirm Publishing Actions. You can either install it by uploading it to your “wp-content/plugins” folder or by using the built-in WordPress plugin installer.

confirm-message-before-publishing-add-plugin

Once installed, this plugin will alert you whenever you try to publish, update and delete a post in your WordPress site. This plugin doesn’t have any settings to configure, so you don’t have worry about any additional settings.

Add a Code Snippet

In case you don’t want to add another plugin, you can simply copy and paste the following code snippet into your theme’s “functions.php” file.

 
function add_publish_confirmation(){
    $confirmation_message = "Are you sure you want to publish this post?";

    echo '<script type="text/javascript">';
    echo '<!-- var publish = document.getElementById("publish");';
    echo 'if (publish !== null){';
    echo 'publish.onclick = function(){ return confirm("'.$confirmation_message.'"); };';
    echo '}';
    echo '// --></script>';
}
add_action('admin_footer', 'add_publish_confirmation');

confirm-message-before-publishing-add-code

If you want to change the custom message, just edit line two of the code. Once you are done adding the code snippet, just save the file. From now on whenever you try to publish or update a post, a confirmation message will appear to make sure that you are publishing that specific post because you wanted to.

As this code is not theme specific, you can even add it to your site-specific plugin so that you won’t have to clutter your functions.php file.

That’s all there is to do, and it is that easy to add a confirmation message before publishing a post. Do comment below if you face any problems while adding this code.

Setup Your Own Self-Hosted Survey Application and Create Unlimited Survey Forms

While there are tons of tools and services that you use to create survey forms and conduct surveys, If you wish to have full control over your data, LimeSurvey is a good survey application that you can install on your own server and host your own surveys.

4 Reasons Why A Third Party DNS Server Is Better Than What Your ISP Gives You

You’ve probably heard of alternate DNS servers and how they could probably help you in some way or another. You may also wonder why you need to switch over. I’m going to give you some reasons why you probably should be using third party DNS server. You will end up wondering why you haven’t done it yet.

Speed Dial with Full Online Sync For Firefox

Even being a veteran browser, Firefox has not been able to implement the Speed Dial function well. That’s where FVD Speed Dial comes into play. This fully functional Firefox addon fundamentally changes the Speed Dial feature to what it should have been all along.

How to Quickly Close Multiple Tabs in Browser

There are times when you opened too many tabs in your browser and it is causing the whole system to slow down. A quick and easy way to fix this is to close as many unused tabs as possible to minimize the memory usage. However, it can be a chores if you have tons of opened tabs. Luckily, most browsers come with a way for you to quickly close multiple tabs with a single click.

Is Your Email Provider Leaking Your IP Address to Recipients? Here’s How to Find Out

If you care about your privacy, you need to make sure that your email provider is not leaking your IP address to recipients. Here’s the tool for the job!

Hacked: 11 Signs Your Online Security Is Being Compromised

When you start to see weird behavior on your PC, it could be signs that your online security has been compromised. Here are 11 signs you should take note of

Useful Resources to Learn Android and iOS Coding Online

If you have thought of learning how to code this summer break, here is a list of some of the most useful resources for you to learn Android and iOS coding.

3 Reasons Why Encryption Is Not as Safe as You May Believe

What if I tell you that your encrypted data may already be cracked by the hackers? Here are some examples why encryption is not as safe as you may believe.

How to Schedule Downloads In Firefox

If you are concerned that your browser won’t be able to handle multiple downloads, you can use Download Plan to schedule downloads in Firefox

What’s New in WordPress 4.0 – Features Round Up

WordPress released the beta version of WordPress 4.0 that includes some new and improved features to improve back-end user experience. Let’s check out what’s new in this WordPress 4.0 Beta 1 Release.

Should I Use a Website Creator or Hire a Web Designer?

If you are starting to setup your website, it can be hard to decide whether to hire a web designer or go with the different DIY website creators out there. Here are some points you should consider.

5 Mistakes That Every WordPress User Should Avoid Making

As we focus all our attention to post great content, we tend to make some mistakes on WordPress that can be fatal. Here are top 5 mistakes that every WordPress user should avoid making.