0

I read an article (which I didn't save) that argued you can improve the performance of your site by changing all file paths to full paths, so for instance, instead of <img src="<?php bloginfo('template_directory'); ?>/images/headers/image.jpg" /> we go with <img src="http://domain.com/.../images/headers/image.jpg" />.

My platform has its own theme, meaning that it will only be updated if we update it. So changing paths should not be an issue. Also, the article suggested that you do the same type of changes everywhere, e.g. script files, functions.php, plugins (if you can be bothered to redo it every time they update...).

So the question is, how much performance will this improve? Surely sending less requests on a page load should make some very minor, but noticeable, improvement?

1 Answer 1

5

This is nonsense. Almost all URL getters are a result of get_option(), eg. get_option('stylesheet_root'), get_option('template') and so on.

These options are loaded very early during the request, they are cached and not fetched again.

Since the options are fetched anyway, all you can improve is processing time. Nanoseconds. This isn’t worth the trouble. Just compare to the time you need when you have t change something in all those files (switching to HTTPS, to a sub-domain, changing permalinks).

Install a good caching plugin. That will improve load time much, much more.

4
  • This is what I thought indeed. I thought that article was a bit out there when I read it. Let me try to Google it and see if I can link you to it. Thanks for the answer, I will accept it soon.
    – Christine Cooper
    Jan 29, 2013 at 15:55
  • 1
    I can't seem to find that particular article, however found various articles that suggest to hardcode paths but some of their other optimisation techniques are quite ridiculous so it doesn't hold any credibility.
    – Christine Cooper
    Jan 29, 2013 at 16:02
  • 1
    @ChristineCooper I have read that multiple times over the years. No need to generate backlinks for that. The most expensive function in WordPress is wptexturize(), not any URL getter. Disable that to get something to measure. :)
    – fuxia
    Jan 29, 2013 at 16:12
  • Is wptexturize() used much or am I safe to disable it? I had a look at the codex page but it doesn't give me an overview of its importance.
    – Christine Cooper
    Jan 29, 2013 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.