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.

What is Bitcoin And How You Can Utilize It Online

Do you know that the Internet actually has its own currency. Since 2009, we can pay and get paid using Internet’s own currency – Bitcoin.

How To Read ODT Documents Inside Your Browser

Various web services can open Microsoft Office files with ease, but what about files created with LibreOffice? The good thing is, you can also read ODT document in your browser as well.

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.

Add Events to Google Calendar From Anywhere in the Web

One of the biggest complaints about Google Calendar is that you can’t add events to Google Calendar without visiting the site. With Spot – Calendar’s Best Friend, you will be able to add events to Google Calendar, whenever you come across one anywhere in the Web.

How to Easily Enable Real-time Collaboration on Your Site

If you are a webmaster, you might be thinking of how you can make your website more interactive, or even allowing your visitors to collaborate with one another. TogetherJS allows you to easily add a real-time collaboration feature to your site with minimal technical/coding skill.

How to Check Your Network Connection With Chrome Connectivity Diagnostics

If you need a simple and easy-to-use tool to check your network connection, Chrome Connectivity Diagnostics by Google is the best tool you can find.

What You Need to Know About Future Web Standards (That are Making the Internet Better)

The Internet started 40 years ago and many things have changed since then. Let’s take a look at the future web standards and how they improve the Internet.

Import Email From Other Services to Outlook.com Using IMAP

With Outlook.com, it seems that Microsoft has hit the jackpot with an email service that competes with Gmail. Read on to find how to import IMAP messages.

Mastering Keyword Searches for Better Productivity in Firefox

Mozilla don’t call their address bar the “Awesome Bar” for nothing. Master the keyword searches in Firefox and turn the Awesome Bar into a productive tool.

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.

Looking For a Secure Chat App? Try BitTorrent’s New P2P Messenger Bleep

Looking for an app to chat securely and privately with your friends? Try BitTorrent new P2P messenger Bleep that offers end-to-end encryption.

How to Convert Images to Text (OCR) With Google Drive

Rather than using an expensive OCR software, you can now use Google Drive to convert image to text. Here’s how you can do so.