Plugin Fix for WordPress “Edit Post” Cache Bug
Lately, after upgrading all of my blogs to the latest WordPress version, I've noticed a strange behavior when editing my posts. It appears that whenever I pressed "Save," the post content would not update on the administration console. On the other hand, it would update on the main site.
For example, if I edited a post, everything from the title to the actual body of the article would not change. I would still see the original content when logged into the administration console. But if I viewed my site, everything would appear normally. The changes would only have reflected on the actual public portion of the blog! Even weirder was that when I checked my MySQL database, nowhere was any record of the original version! So where was WordPress pulling this outdated post data from?
Research
Last night, I was getting really pissed fighting this problem. So, I scoured the message boards for choice keywords related to my dilemma. The following threads were really helpful in diagnosing the problem:
- Edited post not updating in edit window after submission
- Edit shows first version of post
- Edit post weird behavior
- Edit shows first version of post
- Website not updated when database changes
- Cache in WP 2.0 beta
- V2.0.2 and cache
WordPress Caching
Apparently, this glitch has to do with the new WordPress caching system. For some strange reason, the developers of WordPress (Don't get me wrong! They're awesome!) implemented caching in the administration console. Everyone knows that this is overkill and unnecessary! Server-side caching is best employed when a wide audience is accesses a page. Usually, only one person sees the administration console, five people tops.
Plugin Fix
So, after reading the threads, I took a member's suggestion of writing a plugin. But, instead of implementing a button that I would manually have to pressed each time things are acting up (like the person suggested), I wrote a plugin that automatically clears the cache on each administration page load.
I'm providing this plugin to the public so people will not have to go through the same ordeal. Just paste this code into a uniquely named *.php file in the "plugins" directory (Example: "admin_cache.php").
-
span style="color:#008000;">/*
-
Plugin Name: Admin Cache Disabler
-
Plugin URI: http://www.hackernotcracker.com
-
Description: A glitch in some WordPress installations does no update the "Write Post" (Edit Post) page after pressing "Save." This bug is due to the caching system in WordPress. This plugin flushes the cache on each page load in the administration console. THIS PLUGIN ONLY WORKS WITH WP 2.0 AND ABOVE!
-
Author: Allan Barizo
-
Version: 1.0
-
Author URI: http://www.hackernotcracker.com
-
*/'admin_head', 'wp_cache_flush'
May 7th, 2006 at 3:20 pm
Hi! Thanks for this GREAT plugin; not the most flashy but one of the most USEFUL one may find, when struck by the "Write page gives me an older version" syndrome... Ok, I installed it a few days ago, and it would work great, what a relief... but now it seems to do it again :((( I tried deactivate/reactivate but it still gives me an older version at times, so I need to use the "Cache Swoosh" plugin (which still seems to work). Any idea? And thank you again. I though maybe, as a complement, someone could come up with a simple "Cache swoosh" direct link in Admin links general menu. FWIW.
May 8th, 2006 at 11:33 am
I looked at the code in the "Cache Swoosh" plugin (http://rane.hasitsown.com/blog/plink/technical/31/plugin-to-flush-wordpress-cache/) and I really found no difference in the core functionality. Both my plugin and the Cache Swoosh plugin use the same function wp_cache_flush(); to flush the cache.
May 27th, 2006 at 3:51 pm
Hi,
just installed your plugin into my WP 2.0.2 and I still get the old content in the edit post field while the preview is update.
I would really need to know how to solve this.
Many thanks.
HYG
May 28th, 2006 at 12:59 pm
Really, I cannot find any reason why it doesn't work. But if you are desperate, I suggest that you temporarily turn of the cache. In the wp-config.php file, insert this line of code, "define('DISABLE_CACHE', true);"
May 28th, 2006 at 3:48 pm
Thanks, really.
I did what you suggested, actually. It worked. What really strikes me is that WordPress is still performing exceptionaly well, even without cache.
Thanks very much for your time and your disturb in responding me.
Ciao,
Max
July 11th, 2006 at 7:24 am
[...] Thank god there’s actually a solution for this. And blur me didn’t notice it until today even though a plugin fix was published three months back. ZZZzzz… [...]
June 17th, 2007 at 2:06 pm
[...] Except, this doesn’t work for me. I have scoured the web, including the WordPress forums. People seem to have all sorts of problems, some have even created plugins to purge the cache when the admin loads. Am I missing something? Isn’t WP-Cache supposed to purge the static files when content is updated? And if not, shouldn’t there at least be an option to tell it to do so? [...]
April 13th, 2013 at 2:57 am
[...] including the WordPress forums. People seem to have all sorts of problems, some have even created plugins to purge the cache when the admin loads. Am I missing something? Isn’t WP-Cache supposed to purge the static files when content is [...]
January 11th, 2014 at 3:37 am
I'm really impressed together with your writing skills as well as with the layout to your blog.
Is that this a paid theme or did you customize
it yourself? Either way keep up the excellent quality
writing, it is rare to see a great weblog like this one
nowadays..
My weblog; Kayleigh
January 17th, 2014 at 6:48 pm
air structure...
Keep in mind though that it nevertheless significant which you get your concept shipped for your consumers within the clearest and many beneficial way. So even when you've got coupon codes, make sure that the style and message are nicely created. For ...
February 27th, 2014 at 7:02 am
WOW just what I was searching for. Came here by searching
for acheter pharmacie
Here is my web site: cialis
February 28th, 2014 at 6:23 am
Neuhaus had little competition, since few other confectionary
makers could keep up with the complicated flavors he
created. This is because they can be given out in various occasions such as
birthdays, anniversaries, get-togethers, and a whole
lot more. First off, working from your own home can be very isolating.
Look at my homepage: emballages bonbons (http://www.bonbons-perles-des-vosges.fr)
March 5th, 2014 at 2:55 am
fabriquer un drapeau - Borney.fr - banderole publicitaire - fabrication en france Achat drapeaux, fabricant de drapeaux français banderolles publicitaires
This website really has all the info I wanted concerning this subject and didn't know who to ask.
Look at my blog bandrolle (http://borney.fr/fr/pavillonnerie-et-drapeaux/pavillonnerie-de-loisirs)
March 16th, 2014 at 1:08 pm
http://www.youtube.com/watch?v=N8jMbesjc6s
assigned a Fortune 1000 company as your client and you.
You2bile is one of those Sony Ericsson W995 apps that offers the opportunity to view You -
Tube videos on the mobile phone. There may be many Nokia hacks to check the date of birth
of the phone but the better Nokia hack to know
the exact age of your phone is the combination *#92702689#.
My page Gmail Password Hack (http://Www.Youtube.Com)
April 3rd, 2014 at 5:33 am
I really like it when folks come together and share ideas.
Great site, continue the good work!
April 9th, 2014 at 12:44 pm
Hey there! Do you know iff they make anny plugins
to protect against hackers? I'm kinda paranod about losing everything I've
worked hqrd on. Any suggestions?
Here is my blog post: buy garcinia cambogia blast - Dessie -
April 21st, 2014 at 1:04 am
This is very attention-grabbing, You are an excessively skilled
blogger. I've joined your rss feed and look ahead to in search of more of your great post.
Also, I have shared your website in my social networks
April 24th, 2014 at 3:21 am
Wow, marvelous weblog layout! How long have you been blogging for?
you make running a blog glance easy. The full glance
of your web site is wonderful, as neatly as the content material!
my web blog; Locksmith hermitage tennessee Pricing