WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can easily link to my archives page by creating a link: <a href="http://server.com/wordpress/archives.php">Archives</a>. As I was editing my WP template, I noticed that there are a number of functions that WP uses to link to other pages. For example get_the_category_list returns a list of links. If I want to make my template more general, it would be nice not to hardcode the URL of my archives page and to use a WP function instead.

In general, how should template designers create links to WP generated pages?

share|improve this question
up vote 0 down vote accepted

This link Wordpress Codex: Linking... provides detailed information on how to link different types of content. One nice feature that solves the above problem is to use a link of the form /wordpress/archives.php. This will transfer nicely (in most cases) to any particular server deployment.

Further, looking in wp-includes/link-template.php gives you more insight to what kinds of tools are already available for creating links. Particularly helpful is home_url() which allows you to try to be as server agnostic as possible.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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