I don't know php, I just edit it for my needs, please excuse my possible mis-use of terms. I think the fact I am searching for the wrong terms has made this difficult to find a solution for, which is why I am asking.

Basically I need to define a postid, then use it multiple ways.

$number = 455;

So above you can see the number of a postid.

Then within my templates I am using it as follows.

echo get_the_permalink( '$number' );

How do I make that work?

echo get_the_permalink( '455' );

^ works fine, but it means me typing that id a lot.


When you use the variable, don't use the quotes. So it would be like:

echo get_the_permalink( $number );

You can also use:

echo get_permalink( $number );


the_permalink( $number )

get_the_permalink() is an alias for get_permalink().

  • ha, simple as that. Thank you very much for your help! – Tim Aug 13 at 19:55
  • Glad to hear it helped! – Aida Aug 13 at 20:05

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.