Home » Functions » get_page_uri

Function Name: get_page_uri

WordPress Function Description: The get_page_uri function is used to retrieve the URI (Uniform Resource Identifier) of a specific page in WordPress. It returns the permalink for a given page ID or page object. This function is commonly used to retrieve the URL of a specific page to be used in links or for generating dynamic content.

Usage Example: Let’s say we have a page with the ID of 42 and we want to retrieve its permalink. We can use the get_page_uri function like this:

$page_id = 42; $page_uri = get_page_uri($page_id);

By calling the get_page_uri function and passing the page ID as a parameter, we assign the returned value to the $page_uri variable. Now we can use this variable to output the permalink wherever needed, such as in a navigation menu or a custom template:

Register an account to save your snippets or go Pro to get more features.