Homepage of WordPress Blog Not Updating for New Posts

monkey_wallpaper

Lately, I am encountering a problem with my wordpress blog. It is that the homepage or front page does not update instantly. Thus, newly posted articles do not appear right away. The issue does not affect registered users (which is only me and that doesn’t make any sense) and returning visitors. Basically, new visitors that will view my blog are going to see old posts in the front page. When the page is reloaded, the page will update and new posts appear. But of course, if you are the visitor why the hell you are going to reload a page if it seems to work fine? This is not a major issue for some but it is a bit frustrating why such happens in my blog.

Homepage of WordPress Blog Not Updating Fix

I have WP Super Cache installed and some other performance plugins that minify and compress static files before being served to visitors. Cloudflare is also activated in my blog. So the thing that will come up in mind is that WP Super Cache is the culprit. Cloduflare couldn’t be blame about this problem since by default, Cloudflare does not cache html or php files. It only caches static files like images, css and javascript. Thinking that WP Super Cache is making the problem,  I deactivated and uninstalled it.  I also uninstalled other performance plugins that maybe interfering and causing the issue.

Note: This problem is in conjunction with the post Ruined Blog Visits: WordPress .GZ Compressed File.

Aside from the problem posted in the article link above, the not updating homepage issue was not fixed by uninstalling the caching plugin. I also tried purging the Cloudflare cache and activating Development Mode in Cloudflare but still with no avail. I am running out of ideas what is causing the homepage not to list the latest posts for new visitors.

Right now, I am contacting my hosting provider if they are using a caching program on the server side since I already did everything I know that can fix the issue. I have this feeling that they are using Varnish cache but I can’t verify it since controls are not available with a shared hosting CPanel account. My host verified that the server uses Varnish cache. But, it wasn’t the one that causes the problem as other websites hosted in the same server do not have any issue like mine.

June 19. With the help of the guys in Network Panda, I finally found the culprit of this caching issue. It is caused by set of lines found in the .htaccess file:

## BEGIN Expires Caching (Leverage Browser Caching) ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 2 week"
ExpiresByType image/jpeg "access 2 week"
ExpiresByType image/gif "access 2 week"
ExpiresByType image/png "access 2 week"
ExpiresByType text/css "access 2 week"
ExpiresByType application/pdf "access 2 week"
ExpiresByType text/x-javascript "access 2 week"
ExpiresByType application/x-shockwave-flash "access 2 week"
ExpiresByType image/x-icon "access 2 week"
ExpiresDefault "access 2 week"
</IfModule>
## END Expires Caching (Leverage Browser Caching) ##

When I commented out/removed these expires rules, the homepage and all other pages started to work fine. It is not instant and took some minutes to take effect. These lines were added by a wordpress plugin to extend the expiry time of static content in my blog. However, it did not do just that and even interfered with the dynamic content. The line in bold letters is the one I suspect that created the issue. I tried to change it to a lower value at first but it didn’t resolve the problem. Well, I’m better off with these rules.

Step by Step Troubleshooting

If you experience the same situation and given that you already deactivated or uninstalled plugins you suspect that cause the issue, you better look at your .htaccess configuration. Troubleshooting .htaccess might be tricky especially if you have no enough knowledge about these things.

Before making panic, make sure that you already did the following troubleshooting:

1. Caching Plugins

If you are using a caching plugin like WP Super Cache or W3C Total Cache in your wordpress installation, make sure that you had already purge its cache. You can also try deactivating and uninstalling it.

2. Cloudflare Settings

If your website is Cloudflare activated, purge the Cloudflare cache or turn on Development Mode in the Cloudflare settings. Also try to shorten the browser caching time if you altered the default settings. It is configured as 4 hours by default. Technically, Cloudflare doesn’t cache dynamic content but it is still worth trying especially if you created page rules or changed some of its settings.

3. HTTP Response Headers

Look for the expires headers of your website/blog. You can check it online with Web Sniffer or by installing a plugin in your browser that can view HTTP Request and Response headers. If you are using Firefox, the Live HTTP plugin is the way to go. Alternatively, you can use IsVarnishWorking as it shows the response header of the website being checked. This way, you are checking both the HTTP headers and  the Varnish cache status if it is activated in your website. To be specific, the lines that says Cache-Control, Age, Expiry Date are the ones you need to know. These things should be present in the result and has value that is not no-cache or zero. If no-cache or zero is shown then you definitely have no caching issues!

Sample HTTP Response Headers:

HTTP Response Header


HTTP/1.1 200 OK
 Server: Apache
 X-CF-Powered-By: WP 1.3.18
 X-Pingback: http://www.spideylab.com/xmlrpc.php
 Link: <http://wp.me/66O9y>;; rel=shortlink
 Vary: Accept-Encoding
 Content-Encoding: gzip
 Cache-Control: max-age=1209600
 Expires: Thu, 02 Jul 2015 04:03:29 GMT
 Strict-Transport-Security: max-age=15768000; includeSubDomains
 Content-Type: text/html; charset=UTF-8
 Content-Length: 22749
 Date: Fri, 19 Jun 2015 09:53:43 GMT
 X-Varnish: 1857642409 1856766782
 Age: 107414
 Via: 1.1 varnish
 Connection: keep-alive

The response above shows that the page being accessed is a cached copy and will expire by July 2, 2015. If you have somewhat similar response, then check out #4. On the other hand, if you get a response that is similar with the response below, then Congratulations! The issue was already fixed or it doesn’t really exists in the first place.

HTTP Response Header

 HTTP/1.1 200 OK
 Server: Apache
 X-CF-Powered-By: WP 1.3.18
 X-Pingback: http://www.spideylab.com/xmlrpc.php
 Link: <http://wp.me/66O9y>;; rel=shortlink
 Vary: Accept-Encoding
 Content-Encoding: gzip
 Strict-Transport-Security: max-age=15768000; includeSubDomains
 Content-Type: text/html; charset=UTF-8
 Content-Length: 22823
 Date: Fri, 19 Jun 2015 09:57:27 GMT
 X-Varnish: 1857644543
 Age: 0
 Via: 1.1 varnish
 Connection: keep-alive

This one shows the server’s default settings. No caching plugins and no alterations done in .htaccess file.

4. .htaccess Configuration

Check it on the server side. Look for expiry and cache control variables in .htaccess. You might be missing things somewhere. Also, if you have the same lines inputted in .htaccess like mine, backed it up (the .htaccess file) then delete those lines. Wait for few minutes before you try to visit your blog again.

5. Server Fault

Lastly, if the issue wasn’t fix, it is now time to contact your hosting provider. You already did what you can and the issue is definitely caused by misconfiguration of the sever.

Note: Make sure you are using a cache/history cleaned browser (you are not logged in) or just turn incognito mode everytime you did one troubleshooting step.

Blog Performance

In the sake of “performance scores”, Cloudflare can catch up in terms of browser caching. I personally set 8 days as the expiry of my static files, the image files only to be more accurate. Currently, images in my blog are being served through Cloudflare CDN and all other files are requested directly from my main host. I prefer my blog to run this way since I find pages to load fast even without Cloudflare :-P. For now. this setup will not create serious bandwidth and resource problems. In the future, I might need to take action on upgrading my hosting account or caching more content with Cloudflare.

Scroll to top