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.

Show Notification Counts on Pinned Tabs in Chrome

Do you use pinned tabs in Chrome as a way to keep up with your email and/or social networking sites – like Facebook, Twitter, and LinkedIn? Wouldn’t it be great if you could display notification counts for messages and unread items on your pinned tabs? Here’s how you can do so.

Can Tor Really Protect Your Online Privacy From The NSA (And Other Government Organizations)?

When the news that the NSA are keeping records of your phone calls and web data transfers broke out, people start to worry if they are really safe online and some of them switched to Tor to protect their privacy online. The question is, is Tor really safe? Does it really protect you from the NSA’s clutches?

How to Encrypt Your Gmail Message and Protect Your Privacy

If you are really concern about the privacy of your email, you should really consider encrypt your Gmail message so even Google can’t view it.

Secure Your Yahoo Account With Second Sign-in and App Password

Yahoo has added a feature called Second Sign-in that allows you to secure Yahoo account with two factor authentication. Here’s how you can enable it.

Make Mobile Firefox Always Runs in Desktop Mode

If you are using Firefox on a tablet, you may want to switch it to run in Desktop mode by default so websites will always load the desktop version.

Internet Regulation: Is it Going to Happen Soon? What Can You Do About It?

If one country could ban a website from its borders, what prevents other countries from doing the same? Can Internet regulation ever be good?

How to Know the Word Count of Any Text in Firefox

For those who need to keep track of word count, Word Count Tool for Firefox allows you to easily find out the word/character count of highlighted text in the browser.

Three Free Fonts to Spice Up Courier

Courier New is the most popular variant of the monospace typeface. Here are 3 free versions of Courier to spice up your working environment right now.

How Anonymous Are You on the Internet, Really?

If you really want to be anonymous on the web, here are a few things you got to know and also learn a couple of tenets.

9 YouTube Features You Probably Haven’t Heard of

Along with the great content, YouTube has also got a lot of great features. Here’s a list of 9 really useful YouTube features that you probably haven’t heard of.

Easily Make Old Extensions Work with Current Version of Firefox

Sometimes, you are not able to install old extensions as they are not compatible with your current version of Firefox. Here is how you can force compatibility and make them run.

Test Your Website in Various Mobile Devices Without Physically Owning the Devices

Google Chrome comes with a nifty tool that allows you to test how your website render in various mobile device. Here is how you can use the device mode in Chrome.