0

I am facing problem from wp cache. I have an contact listing page. When user delete on of his contact from the listed contacts then on the page it show that the record has been deleted and even record also disappear from the page but when the user again come to that page or refresh the page then the deleted record again come in the list. Although in the database that record has been deleted. When I press Ctrl+F5 then all thing is working fine.

After reading many forum I knew that this problem is due to Cache plugins. So I disable wp_supercache plugins and I also disabled the wordpress's own cache but yet I have to press ctrl+F5 to remove the deleted records from the html page.

Please help so that wp cannot set any kind of cache.

Thanks in advance.

migrated from stackoverflow.com Dec 21 '11 at 14:26

This question came from our site for professional and enthusiast programmers.

3

In the header of the template file in question (probably header.php in the theme directory), try adding:

<?php nocache_headers(); ?>

This doesn't sound like it is a problem with the cache plugins, which basically control caching on the server, it is more likely that this is caching on the client. This will tell the browser not to store a copy of the page.

Reference: http://codex.wordpress.org/Function_Reference/nocache_headers

A quick and nasty solution is to add this as a child of the HTML head element too:

<meta http-equiv="cache-control" content="no-cache" />

Hope that's what you're looking for!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy