Getting the relative permalink of a page
-
Let’s say my wordpress site is at https://mysite.com/wordpress. I have a page called “foo” and it has a child called “bar”. My permalinks are set to /%pagename. The full permalink of bar would be:
https://mysite.com/wordpress/foo/bar
I can get this full permalink using get_permalink(id_of_bar). However, let’s say I want only the part of the permalink that is relative to the inside of the wordpress site. That would be:
/foo/bar
(I’m assuming this is the link that is internally redirected to index.php when retrieving the page; i.e. https://mysite.com/wordpress/index.php?pagename=/foo/bar)
How do I get just this part of the permalink?
Scott
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Getting the relative permalink of a page’ is closed to new replies.