How To Add Confirmation Dialog To WordPress Publish Button

Have you ever accidentally published a post on your WordPress, which was still a piece of trash with some uncompleted content? I did tons of times, so I came across an article on WPBeginner, which was titled as, How to Avoid Accidental Publishing in WordPress.

So, I thought that I should share this trick on my site as well. It’s a really useful trick if you’re a lazy Panda like me. It’s really good to double-check your article before posting it. In short, we will add a confirmation dialog to WordPress publish button, which will appear whenever you click on the publish button to confirm your action.

Just add following code to your current theme’s functions.php file: