Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.