[wp-hackers] Overwrite bloginfo() function

Ozh ozh at planetozh.com
Tue Feb 26 13:08:03 GMT 2008


>I'm considering to write a plugin to modify (or overwrite) the default
>bloginfo() function without patching system files.

When you want to modify a core function behavior, use the plugin API. For 
instance, the following is roughly what you need:

add_filter('bloginfo', 'mybloginfo', 1, 2);
add_filter('bloginfo_url', 'mybloginfo', 1, 2);

function mybloginfo($result='', $show='') {
        switch ($show) {
        case 'wpurl':
                $result = SITE_URL;
                break;
        case 'template_directory':
                $result = TEMPL_DIR;
                break;
        default: 
        }
        return $result;
}

More info:
http://codex.wordpress.org/Plugin_API


Ozh
-- 
http://planetozh.com/blog/ 



More information about the wp-hackers mailing list