By default, WordPress publishes posts and pages immediately when you click the Publish button. To reduce the risk of publishing content with errors, you can add a confirmation message that prompts the author to double‑check before publishing. On ruachost.com, this can be achieved by adding a small script to your theme.
Why Add a Confirmation Message?
-
Prevents accidental publishing of incomplete or incorrect content.
-
Gives authors a chance to review before making content live.
-
Improves editorial workflow and site quality.
Steps to Add Confirmation Message
-
Log in to WordPress with an administrator account.
-
In the dashboard, go to Appearance → Theme Editor.
-
From the right‑hand column, select the file named functions.php.
-
Scroll to the bottom of the file and add the following code:
add_action('admin_print_footer_scripts', 'wp_confirm_publish'); function wp_confirm_publish() { echo "<script> jQuery(document).ready(function($){ $('#publishing-action input[name=\"publish\"]').click(function(){ if(confirm('Are you sure you want to publish this?')){ return true; } else { $('#publishing-action .spinner').hide(); $('#publishing-action img').hide(); $(this).removeClass('button-primary-disabled'); return false; } }); }); </script>"; } -
Click Update File to save changes.
✅ Now, whenever you click Publish, WordPress will display a confirmation message before proceeding.
Important Notes
-
Always back up your theme files before editing.
-
Consider creating a child theme to preserve changes during updates.
-
This customization applies to the Classic Editor. If you’re using the Block Editor (Gutenberg), you may need a plugin or custom script adjustment.
✅ Summary
-
Edit
functions.php→ Add confirmation script → Save changes. -
WordPress sites hosted at ruachost.com will now prompt authors with a confirmation message before publishing.