Fragment Caching in WordPress

Mark on WordPress

Fragment caching is useful for caching HTML snippets that are expensive to generate and exist in multiple places on your site. It’s like full page HTML caching, but more granular, and it speeds up dynamic views.

I’ve been using this fragment caching class for a few years now. I optimized it around ease of implementation. I wanted, as much as possible, to be able to identify a slow HTML-outputting block of code, and just wrap this code around it without having to refactor anything about the code inside.

Implementation is pretty easy, and you can reference the comment at the start of the code for that. The only thing to consider is that any variables that alter the output need to be build into the key. It should also be noted that this code assumes you have a persistent object cache backend.

View original post


7 deadly sins of WP development

1. Loading your own copy of jQuery
2. Not loading JS/CSS files properly
3. Not escaping user input in SQL and not encoding user input on output
4. Incorporating too many 3rd Party Services
5. Expecting too much from shared hosting
6. Using “admin” for a username with an insecure password
7. Adding tons of plugin-type functionality to a theme’s functions.php

New blog

After 2008 shutdown I was missing a public and non-useful place for my random rants on coding as well as other cool things, news, links and so on.

Even worse I was lacking a proper account. Unacceptable.
That’s the true story behind this new URL: no real reason but curiosity, at least now.

Feel free to check out my  WordPress plugins while I think something cool to write! 🙂