This morning I was having some technical problems with my “Learning Ruby – TDD Style!” Parts 1 and 2 blog posts, specifically how pings were handled when linking posts to each other on update. A side effect of a post update meant a comment would be automatically created in the blog post that it referred to. Since I was adding and will continue to add “navigation” functionality for the different post-parts in order to make life easier for the readers, the present set up was not adequate.
When writing or updating a post in WordPress, there is a box on the right hand side of the screen entitled Discussion with an item for allowing pings. The solution was simple enough: All I needed to do was update each page, uncheck Allow Pings, save and delete any lingering ping comments. Simple enough. Somewhere along deleting the ping comments in my early morning haze, I accidentally deleted one of my blog entries!
I was able to verify that I did this by navigating to the user facing page to be greeted by a “Page Not Found” error. Fantastic! Unfortunately, I was quick to find out that WordPress does not have an undelete option for posts and since I visited the user facing page, I no long had my blog entry in my local cache. After hitting up some of the big name search engines to find a cached copy without success, I needed to figure out a better way of recreating my blog entry without having to do it from scratch.
After much cursing took place, I decided to make another go of playing with the cache. The following is the technique I came up with using just the browser I was blogging in:
- Put the browser in “Work Offline” mode – usually found under the first couple drop-down menus in your browser
- Navigate to the page that was being edited by looking at the browser history
- Breathe a sigh of relief when you see your blog entry in the post textarea
- Copy and paste your “post” to somewhere safe
- Create a new post and paste in your recovered post
WordPress seems to manage their pages for post edits by using the following URL syntax:
In order to figure out your post id, you can always go to the “Manage – Post” section in your blog administration console and see the post ids for the posts that you still have. Using this information you can make an educated guess what the post id is for the post you deleted.
The drawback in using this approach is that your subscribers will end up with multiple entries in their feed of the same title. A small price to pay I figure…