to get the URL of any post or page in WordPress first you need to get the id of that page or post, and for that go to admin panel and open the post or page for edit and on URL you will find ?post=
Now Keep the page or post id in a variable
Example:
$post_id = 40;
Then call the function get_page_link() and pass the post id through the function and print it and you will get the id
Now here is the full code
Thanks for Reading