How to Recover/Restore Deleted Post in WordPress?

Updated on November 2, 2017

Deleted a post by mistake? Don’t panic. It can happen to anyone and it had happened to me many times. Happened is happened, but is there a way to recover/restore deleted post in WordPress? Fortunately, there are few options.

4 Ways to Recover/Restore Deleted Post in WordPress

Look into Trash

If you had deleted a post, WordPress moves it to Trash folder. Login to WordPress, click on Posts > All Posts and look out for 'Trash' link at the top. Click on it to view all deleted posts. To restore the post, just move the mouse on top of the post title and you will find “Restore” link. Click it and you are done.

Recover post from WordPress Trash

What if you had flushed out posts from Trash as well? Ahh! You did that, seriously? Try the below options then.

Recover from Backups

Do you take a backup of your site? Of course, you must be doing that (if not, learn from the mistake and backup WordPress database regularly). Just go ahead and look out for older backup (probably the closest date on which the post was published).

Step 1: Open the WordPress SQL backup file (say backup-oct-2017.sql) and search for deleted post.

# vim backup-oct-2017.sql

Feeling lucky? Then you should be able to get the post ID of the deleted post from the SQL backup file. Now, import the SQL file into a test database as shown below:

mysql> CREATE DATABASE recover_post_db;

mysql> use recover_post_db;

mysql > source backup-oct-2017.sql;

mysql> SELECT * FROM wp_posts WHERE ID=<deleted_post_id>;

Copy the post content from the query output and create a new post.

Caution:

Don’t import the old backup into your production server, as this will result in losing your latest posts.

Search Google Cache

The next option is to try searching the deleted post in Google cache. If you remember the title or keywords of the deleted post, then head on to Google and search for it. For example, if the deleted post title was “Missing Delete option under a category in WordPress?” (you know what, this is the title of the post which I had deleted accidentally), then you can try searching it in Google as shown in the below image. Remember to append your domain name at the end of the search string to prevent seeing posts from other websites. Now click on the tiny pull down menu and select Cached to view the page cached by Google.

Recover/Restore Deleted Post in WordPress

Look into RSS Feeds

If you are publishing RSS feeds, then you may want to check if your RSS reader have a copy of the deleted post. May be, who knows? But its worth checking isn’t?

Don’t want to put yourself in this situation again? Follow the best practices to manage a WordPress website.

Was this article helpful?

Related Articles

Leave a Comment