Skip to content

Instantly share code, notes, and snippets.

@davidchase
Created March 4, 2013 19:50
Show Gist options
  • Save davidchase/5084981 to your computer and use it in GitHub Desktop.
Save davidchase/5084981 to your computer and use it in GitHub Desktop.
Wordpress get page id by its slug
<?php
//get page id's by their slug
function id_by_slug($page_slug) {
$page = get_page_by_path($page_slug);
if ($page):
return $page->ID;
else:
return null;
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment