There is a function called url_to_postid
$id = url_to_postid( get_permalink(40) ); // $id will be 40
Actually (WP 3.6) it works only for standard posts and page, but with WP 3.7 it will also work for custom post types.
There is a function called url_to_postid
$id = url_to_postid( get_permalink(40) ); // $id will be 40
Actually (WP 3.6) it works only for standard posts and page, but with WP 3.7 it will also work for custom post types.