Created
July 26, 2016 02:56
-
-
Save cezarsmpio/23802ea25354a12abd24850512a05897 to your computer and use it in GitHub Desktop.
Wordpress - Get page permalink by slug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The page permalink by slug | |
* @param string $slug The page slug | |
* @return string The permalink | |
*/ | |
function page_permalink_by_slug($slug) { | |
return get_permalink( get_page_by_path( $slug ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment