Return to Snippet

Revision: 30386
at August 13, 2010 01:46 by simonbouchard


Initial Code
function get_page_id($page_name) {
	global $wpdb;
	$page_name = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."'");
	return $page_name; }

Initial URL


Initial Description
This custom function is useful if you want to get the ID of a page.

Initial Title
WordPress: Get Page ID (Function)

Initial Tags
wordpress, function

Initial Language
PHP