WordPress Content Disappeared

Had one of those DUH! moments today.

I was on the phone with a client introducing them to their new WordPress site. The client couldn’t remember the password I set for him so I went into the user area and reset it. While I was there I noticed that I still had the default admin user set up so I deleted it per my customary practice of not making it any easier for hackers.

I then guided the user through making his first post once he logged into the backend. Everything was going fine until we went to look at the post he created and the site’s content was gone. The theme was still there, but no content. I went to the All Posts list and the All Pages list and everything was gone.

“Let me call you back when I get this figured out”. I thought that maybe with both of us in the database something got corrupted.

First I looked at the database and confirmed that the data was all there. It was.

Then I got online and started researching and it seems there’s been some reports of the database getting corrupted but a quick SQL fix database should make it better.

So I logged into phpMyAdmin and ran a fix. No errors were found and the content was still missing. After scratching my head for awhile I went back and looked at the data using phpMyAdmin. That’s when I noticed it.

All the missing pages were in the trash. When I deleted the user, I forgot to check the box to reassign the posts to my username. I had built all of the pages signed in as the default user admin.

Certainly I was distracted by doing this while I was on the phone with a client and should have waited until later. But if all of the sudden you have content missing in your WordPress site, think back did I just delete a user?

To correct it I had to manually change the post_author and post_status fields. Fortunately for me, WordPress doesn’t actually erase the records, it just changes the post_status to trash. Change it back to publish and your content reappears.