Why You Shouldn’t Code URLs in Themes or Plugins

Avoiding the Use of hard-coded URLs is a habit that eventually leads to good coding.

Be it a theme or a plugin, there are a number of instances that require linking to other pages of your site or to spreadsheets or scripts or mentioning your own website’s URL in the code.

This invites a bulk of workload because if the site’s domain name needs to be changed or the theme needs to be used for other sites or you wish to lend your themes to other coders, the whole hard-coded URLs need to be updated.

If this update is inaccurate it leads to improper linking among spreadsheets and URLs and produce the very annoying 404 errors.

It is all the more risky when it comes to plugin coding.

It poses a problem in case you wish to change the plugin’s directory or try to run it on older version WordPress sites, the links will break.

So to save yourself from this tedious and eye-breaking task, it is good to use functions supported by plugin and themes.

It is also a good habit to make use of template tags that enable seamless linking solutions.

read the article here:http://code.tutsplus.com/tutorials/why-you-shouldnt-code-urls-in-themes-or-plugins-and-the-wordpress-functions-to-use-instead–cms-23262

2017-10-06T05:10:01+00:00 0 Comments

Leave A Comment