The core rewrite API does offer the function url_to_postid() (as mentioned by @stephen-sabatini) which can find a post ID from a URL. However it seems less than ideal to have to make a request up front just to determine the post ID……
The core rewrite API does offer the function url_to_postid() (as mentioned by @stephen-sabatini) which can find a post ID from a URL. However it seems less than ideal to have to make a request up front just to determine the post ID……