Wordpress - Get the ID of the page a menu item links to?
The page ID (or object ID, since a menu item can link to any object) is stored in the postmeta
table, with the key _menu_item_object_id
. So you can get the page ID with the following code:
get_post_meta( $item->ID, '_menu_item_object_id', true );