How to replace bloginfo(template_url)

Basically I’ve used bloginfo(template_url) in a WordPress theme, but when I run theme-checker, it recommends to replace bloginfo(template_url) with get_template_directory_uri(), however when I use get_template_directory_uri() it doesn’t work. It works fine if I use it to replace get_bloginfo(template_url) but that’s not what I want now. Is bloginfo(template_url) being deprecated? If it is, what is it’s replacement?

Thanks

5 Answers
5

bloginfo($option) echos out a value whereas get_template_directory_uri() returns a string – did you maybe forget to echo get_template_directory_uri()? Also are you passing a string with quotes i.e. bloginfo(template_url) vs bloginfo('template_url')?

Both bloginfo('template_url') and get_template_directory_uri() should work, they aren’t deprecated.

Leave a Comment