How to Avoid Publishing Content Accidentally in WordPress

Many people have accidentally hit the “Publish” button on a post or page when it really wasn’t ready for live activity. This can cause a myriad of issues depending on what you’re trying to accomplish. Unfortunately, WordPress doesn’t have a default ability to stop accidental publishing.

Luckily, your editorial workflow in WordPress can be avenged. Instead of having the fear sending something live when it’s not ready, you can modify the system to give you a warning. It’s kind of like confirmation messages you would see when installing software. Only in this case, the system is asking if you really want to send content to the website.

Today, I’m going to show you how to prevent these accidents from happening and what you can avoid by doing so. When you start a fast editorial workflow, mistakes can happen. This process can help greatly reduce those problems.

Why worry about accidentally publishing?

While building a website around WordPress hosting gives you plenty of benefits, user error can sometimes foul things up. There are plenty of reasons why you would want to stop accidental posts and pages. From user experience to search engine optimization, a simple click of the mouse can have immediate complications.

For the Visitors:
Imagine visiting a website that has a great title and has a lot of information you’ve been spending hours looking for. Suddenly, the webpage stops in mid sentence. It seems like half of the content has been deleted, right? Now, you have to spend your time looking for answers all over again.

Incomplete text isn’t the only thing that can affect visitors. What if you published something before you had a change to proofread it? Misspellings, grammatical errors and more can make landing pages and posts look unprofessional. In turn, you may lose a bit of respect from your fans. As a result, your online reputation could take a hit.

For the Search Engines:
Now let’s assume you’re a search engine bot. I know, but bear with me here. You get a message from the site that new content has been published. Because this is a popular website, you spring into action to index the webpage. In a flash, you grab all of the available content and start displaying the results. Unfortunately, you had no idea that the author was in the middle of writing the piece. This means a large portion of the content is not immediately indexed.

Missing pieces of content that are not in Google or Bing may influence keywords, phrases and search parameters. Although the search results can be fixed after publishing the content in full, the short-term damage may already be done. This could easily be a part of some of the worst SEO mistakes.

Sharing on Social Platforms:
Some plugins will share content with social media as soon as the Publish button has been clicked. For instance, the Publicize module in the Jetpack plugin does this with all social accounts linked to the tool. This has potential to be very bad if the content being shared isn’t finished or is missing vital components.

All of your fans and followers have potential to visit an unfinished post. If your system is set up to auto publish tweets, you could confuse a lot of people on Twitter.

Using the Publish Confirm Plugin

One of the easiest ways to prevent an accidental publish is by using the Publish Confirm plugin. This simple tool adds a confirmation window to the post and will activate once you hit the Publish button.

It works with all posts and pages while offering a bit of flexibility to other custom post types. You can also customize it to an extent by changing the message that is displayed. I’ll go over that a bit later, though. For now, let me show you how to install and use this tool.

To use Publish Confirm:

Go to the plugins area of WordPress. Click the “Add New” button on the top to open the search window.

Add New Plugin

Enter “Publish Confirm” in the text box on the right.

Publish Confirm Search

Install and activate the Publish Confirm plugin.

Publish Confirm Install

Now, your posts and pages will ask for confirmation when you try to publish something to the website.

Publish Confirm Message

This is an automated tool and does not have settings to modify. It simply adds a new feature connected to publishing content.

Changing the Message Displayed by Publish Confirm

The confirmation message is pretty straight forward. It just asks if you’re sure you want to publish the material. What if you want to change the text in the message? Since this functionality is not available in the settings, you need to do it in code.

This is a real simple copy-and-paste procedure, and you can change the message to anything you want.

To change the message displayed in Publish Confirm:

Go to the appearance area of WordPress and click to open the “Editor.”

Publish Confirm Editor

Make sure the theme you are currently using is selected. Otherwise, use the drop down to choose it and click the “Select” button.

Publish Confirm Select Theme

Find the functions.php file. This often has the header of “Theme Functions.” Do not confuse the file with the “inc/funcitons.php” file in this list. You want the one that only affects your theme. Click the file to open it in the editor window.

Publish Confirm Function Edit

Open a text editor program on your computer system. This is so you can create a backup of the code before you start editing. Windows users can open Notepad, which is a great program for coding.

Paste the code from functions.php into the text editor and save the file onto your computer.

Publish Confirm Save Code

Scroll down to the bottom of the functions.php file and paste the following code at the very end:

[ht_message mstyle=”info” title=”” ” show_icon=”” id=”” class=”” style=”” ]


function custom_confirm_msg() {
return “You are about to publish this piece of content.\nAre you absolutely sure you want to do this?” ;
}

add_filter(‘publish_confirm_message’,’custom_confirm_msg’);
?>

[/ht_message]

Publish Confirm Paste Code

Click the “Update File” button to save functions.php.

Publsih Confirm Update File

The message displayed by Publish Confirm will now show the newest text from the above code.

Publish Confirm New Text

You can place any text within the code you wish in between the quotes and after the return command. This might be a great way to remind authors or even yourself to add featured images, proofread or any other small message you can think of. Perhaps you may want to customize the message with humorous texts or something that is more centered around the business.

When changing the text, pay close attention to the part of the code: \n

This is a carriage return when putting text into PHP. It creates a new line where the following text will begin. You will not need spaces before or after the \n as the system will differentiate these characters from the rest of the message.

If you have a flare for programming, you could also add a few other minor alterations to customize the message even further.

Catching it before problems arise…

Even the most talented of us make mistakes once in a while. The best thing to do is not panic. When you publish something prematurely, it can be easy to make matters worse by trying to rush the rest of the article before too many people see the error. The Publish Confirm plugin can be a great addition to the editorial workflow in WordPress by giving you a way to safely prevent an accidental publish.

What kind of precautionary plugins do you use on your website? How often have you published a post before it was actually ready?

2 thoughts on “How to Avoid Publishing Content Accidentally in WordPress”

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.