Created
August 19, 2019 13:23
-
-
Save nandomoreirame/2367fd31954429318fe395e087d37d39 to your computer and use it in GitHub Desktop.
Function get page ID by slug
This file contains hidden or 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 | |
function get_page_id_by_slug($page_slug) { | |
$page = get_page_by_path($page_slug); | |
if ($page) { | |
return $page->ID; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment