I love it when troubleshooting works and problems disappear.
Yesterday one of my Twitterpals sent out this plea:
is there a wordpress php kung-fu master within cooee?
I’m no kung-fu master, of PHP or of anything, but asked what the problem was. And it was a weird one.
When I viewed the site in question all was well. But after refreshing a page everything would be duplicated. That is, you’d see the header, navigation, post, comments, sidebar, footer, all as you’d expect, but scroll down and there was the whole lot all over again. Bizarre.
I checked some things and asked some questions. The replies didn’t bring progress.
Then I viewed the source of a doubled-up page, and wondered about these two lines:
<!-- Dynamic Page Served (once) in 0.580 seconds --> <!-- Cached page served by WP-Cache -->
That pretty much looked as though the page was being rendered once, as usual, and then rendered again by the WP-Cache plugin.
I asked my pal to disable the plugin. He did. Nothing changed.
He mentioned having been hacked recently, so i suggested reloading the theme from a backup. No change.
I did some validating, some more checking, looked on the WordPress forums, but kept wondering about that plugin. I said it must be something to do with that.
My pal deleted the plugin. Problem solved! Disabling it wasn’t sufficient.
I’m not saying anything against that particular plugin — I don’t use it myself, and I suspect anyway it worked perfectly well for a while. This duplication problem had only been going on for a day or two.
Whatever it was that happened on the last few days, perhaps connected with the hacker activity, had somehow caused the WP-Cache plugin to start rendering everything twice. Deleting is was what solved the problem. In this case the solution came because I viewed the source of the rendered page.
The lessons: when troubleshooting a WordPress site View Source, validate, disable plugins, delete them if necessary, restore a theme from a known-good backup.
You do backup your WordPress theme, don’t you? Do it now.