Получите ID от URL WordPress
// https://developer.wordpress.org/reference/functions/url_to_postid/
url_to_postid( string $url )
Pepiño
// https://developer.wordpress.org/reference/functions/url_to_postid/
url_to_postid( string $url )