I don’t know much about how super cache works, but I see that at the very least, I can find most of the pages of my site in the wp-content/cache/supercache folder. Now, if WordPress cannot connect to the database due to the MySQL server being down (as is the case right now), should it be showing an error message or should it be showing the cached pages?
I would think that it should work regardless of whether the connection can be made or not. Is there an option or a flag that I am missing?
Also, it looks like the main page of the site is not cached, while everything else is. Is there any way to deal with that? Obviously I can’t do anything about that right now, since the database is down, but for the future?
This is a response to your second question — “Also, it looks like the main page of the site is not cached, while everything else is. Is there any way to deal with that?”
In your backend, go to Settings -> WP Super Cache and select the Advanced tab. Look for the section titled Accepted Filenames & Rejected URIs. If
Front Page (is_front_page)
orHome (is_home)
is checked, uncheck it, and then click theSave
button. That should allow your site’s Front / Home page to be cached.NB: This assumes you’re using the WP Super Cache plugin, which I gather from the question’s tags that you are.
(I haven’t tested this, though, so your mileage may vary.)
Seeing as you already have a cached version of your site, I can skip the part that explains how to set that up and skip to the simpler stuff –the PHP stuff!
You want to insert the
mysql_ping()
function at the tippy top of your header.php file in your current theme (or child theme, preferably). It should look something like this:Because the
header
function is in there, you want to make sure this appears before anything else, including an<html>
or<body>
tag.