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 want to simply create a link to a page that I know the title (or ID), but I want to make sure it works on any Wordpress install. What is the best way to do this?

share|improve this question
up vote 2 down vote accepted

You probably want to use get_permalink and get_the_title. Example:

<a href="<?php echo get_permalink( YOUR POST ID ); ?>"><?php echo get_the_title( YOUR POST ID ); ?></a>

Replace YOUR POST ID with the ID of the post you'd like to link to. Post ID's will change from install to install, however, so this might not work as expected.

http://codex.wordpress.org/Function_Reference/get_the_title http://codex.wordpress.org/Function_Reference/get_permalink

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.