[wp-hackers] Bug in get_bloginfo('template_url') w/child themes, or am I doing it wrong?

Mike Schinkel mikeschinkel at newclarity.net
Wed Mar 10 02:03:39 UTC 2010

I'm wondering if there is a bug in get_bloginfo('template_url') with child themes, or am I doing it wrong?

The following code sets $template_url to the parent's URL and not the child theme's URL:

add_action('init', 'tboc_jquery_scripts');
function tboc_jquery_scripts() {
	$template_url = get_bloginfo('template_url');

Is this a bug or am I doing this wrong?  

Additionally shouldn't there be a way to explicitly reference the parent URL and the child URLs (there probably is, I just don't see it)?

Also, what's the philosophy behind those references in general; when not explicitly specified which should be assumed (parent or child) and how does that keep from causing problems in plugins if the plugins refer to themes but don't know which they are using?

FYI, I was able to override for what I'm working using this but I fear that there are cases where this will fail.

add_action('template_directory_uri', 'tboc_template_directory_uri');
function tboc_template_directory_uri($template) {
	$template = str_replace('/twentyten','/thebusinessof',$template);
	return $template;

Thanks for considering these issues.


More information about the wp-hackers mailing list