Friday, April 3, 2009

WordPress Plugin: Change Directory Location of Smilies

We recently moved our WordPress smilies to our caching server (for obvious reasons). Well, we then needed to have WordPress use the new URI. We always want to leave core WordPress code intact unless absolutely necessary, so I wrote this quick plugin to search for the old/original URI and use the new one.

Plain. Simple.

Cheers!


function custom_smilies($text) {
$output = str_replace(get_settings('siteurl') . "/wp-includes/images/smilies/", "http://new.location.com/img/wp/", $text);
return $output;
}

add_filter('comment_text', 'custom_smilies', 30);


Note: This works for WordPress 2.0.1. I'll try and test with 2.7 and any other installations I have installed already later. :)

No comments: