Is it possible to get a page link from its slug?

Question

Is it possible to get a page’s permalink from the slug alone? I’m aware that you can get the page’s permalink from the ID using get_page_link():

<a href="<?php echo get_page_link(40); ?>">Map</a>

I’m curious if there is any way to do the same with the slug of a page – like this:

<a href="<?php echo get_page_link('map'); ?>">Map</a>
0
Sampson 2 years 2021-01-01T09:10:35-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse