Retrieve the template directory URI via global or get_template_directory_uri() every time?

I would stay stick to the function. PHP caches functions for speed and efficiency. In some situations, using a function is faster then using a variable.

There are other benefits too – imagine if you changed the name of your variable – you would have to go and update every piece of code where it’s used.

Leave a Comment