[wp-hackers] Overwrite bloginfo() function

Claudio Simeone mrbrog at gmail.com
Tue Feb 26 12:27:22 GMT 2008


Hi all,

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

I would write a plugin that "overwrites" the bloginfo function if the
parameter is = 'template_directory" or "wpurl". Since these are values
that they often don't change on production sites, I thought that's is
less explensive for the database to write directly the url or
template_dir values without select them from the DB. This could be
useful on high traffic sites...

Eg. something this

<?php
/*
Plugin Name: ...
[....]
Description: .......
*/

define('SITE_URL', 'http://www.mysite.com');
define('TEMPL_DIR', 'http://www.mysite.com/wp-content/themes/default');

function bloginfo($show=''){
if ($show='wpurl') {
echo SITE_URL;
} elseif ($show='template_directory') {
echo TEMPL_DIR;
} else {
// do the original stuff
}
}

?>

I saw there's a function here:
http://codex.wordpress.org/Function_Reference/remove_action

can this be useful for me? Or there's no way to do that i want to do?

thanks in advance,
Claudio


More information about the wp-hackers mailing list