How to insert a link to a Page
-
I want to insert a link to a static page, say, my contact page. I know I can put a static link like “index.php?page_id=42” but that won’t do. I’m using pretty url’s and I want WP to generate the pretty url for me.
Of course, I could put a link like “/contact”, but that won’t do either, since I want the link to work on a dev environment (at https://www.example.com/yadayada/wordpress) and the live environment (at https://www.yadayada.com). Plus the link must keep working even after changing the permalink, structural location, or title of that page. Hence, referring to the page ID is a good idea, but I don’t want it in the HTML.
So to my knowledge, there’s nothing I can put in a plain vanilla
<a>
tag that covers this. Basically I’d like a code or something that generates a link just like wp_list_pages() does.How do I do that? Plugin? Please help ??
I’m hoping for something like
<a href="$page_id=42$">Contact</a>
, but I’m pretty sure that won’t cut it ??
- The topic ‘How to insert a link to a Page’ is closed to new replies.