Skip to content

How to unpublish a WordPress page?

If you are a website developer or blogger, you are probably well acquainted with the WordPress platform. But what do you do if you publish a page and then realize you need to undo it? Is there any way to do this? The answer is yes, there are several ways. Below are the four main methods that will allow you to unpublish a WordPress site.

1. Changing the page status to "Draft"

This is the easiest way to unpublish a WordPress site. Just go to the WordPress administration panel, select the page you want to "unpublish" and change its status from "Published" to "Draft". Here's how to do it step by step:

  • Enter the WordPress administration panel.
  • Click on “Pages” in the left menu.
  • Find the page you want to “unpublish” and click “Edit.”
  • In the upper right corner of the editing screen you will see the “Publication” section.
  • Click “Edit” next to “Published” and select “Draft” from the drop-down menu.
  • Click “Update” to confirm the change.

2. Using the WP Rollback plugin

Another way to unpublish a WordPress site is to use a plugin. There are many plugins that can help with this task, but one of the most popular is WP Rollback.

WP Rollback allows you to quickly return to previous versions of plugins and themes, which is especially useful when the latest update has caused problems on the website.

  • In the WordPress admin panel, go to the “Plugins” section and install “WP Rollback”.
  • After installing the plugin, go to “Plugins -> Installed Plugins”.
  • Find the plugin or theme you want to roll back to a previous version and click “Rollback.”
  • Select the version you want to revert to and then click “Restore.”

3. Restoring the previous version of the page using the "Revisions" function

WordPress automatically saves copies of the page as you edit. This makes it easy to restore a previous version of the page if you need it.

  • In the page editor, in the upper right corner you will see the "Document" section.
  • In the "Document" section there is a "Revisions" option.
  • By clicking on “Revisions” you will see a list of all previous versions of the site.
  • Select the version you want to restore and then click “Restore”.

4. Using a PHP snippet

If you have experience with PHP programming, you can also use a PHP snippet to unpublish a page. Below is a snippet that can be added to the functions.php file in your theme:

function unpublish_post( $post_id ) { $post = array( 'ID' => $post_id, 'post_status' => 'draft' ); wp_update_post( $post ); } unpublish_post( YOUR_POST_ID );

In place of YOUR_POST_ID you must provide the ID of the page you want to "unpublish". You can find this ID in the page list in your WordPress admin panel.

Remember that modifying theme files may lead to errors, so it is always worth making a backup before any modification.

To summarize, there are many ways to unpublish a WordPress site. Choosing the right one depends on your experience and preferences.

Check out the offer of 1500+ Premium WordPress plugins and themes!