Don’t do_shortcode

Shortcodes are pretty cool, and the do_shortcode function is pretty neat as it can parse and execute shortcode callbacks from arbitrary strings, but that function invokes a fairly large regex every time it is called. That regex looks for all registered shortcodes within a string. For each match, it runs a replacement with a callback function, which also take the time to parse the shortcode...

Native Image Sizing “On the Fly” with WordPress

I tweeted it out not too long ago, and it seems to have gotten people’s attention. So why do WordPress theme developers still use TimThumb? One of the valid reasons seems to be dynamic image sizing. Of course if you’re using TimThumb for post thumbnails in your theme, your life saver is the add_image_size function — you don’t need “dynamic resizing” since all...

Don’t Create a Quote Shortcode

Don’t create a “quote” shortcode when the HTML “blockquote” tag does a perfectly good job. I’ve seen themes that have shortcodes for quotes, citations and headers but no support for the same styling with HTML tags.
Sawyer Hollenshead on Building WordPress Themes You Can Sell

Regex Replace in MySQL or lib_mysqludf_preg in Ubuntu Linux

I’ve been working a lot with MySQL lately, especially after the major theme and plugin upgrades on my blog. I was dealing with a bunch of content issues like redundant shortcodes and post meta, URL changes, images directories and more. One simple solution would be to grab the database dump, perform various search and replace operations and then feed it back in, and my goal was to do that...