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
bloginfo($option)
echos out a value whereasget_template_directory_uri()
returns a string – did you maybe forget to echoget_template_directory_uri()
? Also are you passing a string with quotes i.e.bloginfo(template_url)
vsbloginfo('template_url')
?Both
bloginfo('template_url')
andget_template_directory_uri()
should work, they aren’t deprecated.bloginfo
is a wrapper forget_bloginfo
, which just calls those functions directly:so it’s ultimately exactly the same output.
This is the right way –
You Can use both