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?

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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