I want to point out that $wp_query->post->ID and get_the_ID() could be cached depending on a verity of themes, theme builder systems, plugins and other settings. the post below using get_queried_object_id works as the most reliable method outside the loop from an „absolute“ perspective. I have ran into a problem „trusting“ get_the_ID() in many of these modern themes/builder systems out there because they pass the ID through a series of builder page/templates that obfuscates the „REAL“ ID of the page you think you are on depending on what you are trying to do in-template 

I want to point out that $wp_query->post->ID and get_the_ID() could be cached depending on a verity of themes, theme builder systems, plugins and other settings. the post below using get_queried_object_id works as the most reliable method outside the loop from an „absolute“ perspective. I have ran into a problem „trusting“ get_the_ID() in many of these modern themes/builder systems out there because they pass the ID through a series of builder page/templates that obfuscates the „REAL“ ID of the page you think you are on depending on what you are trying to do in-template 

I want to point out that $wp_query->post->ID and get_the_ID() could be cached depending on a verity of themes, theme builder systems, plugins and other settings. the post below using get_queried_object_id works as the most reliable method outside the loop from an „absolute“ perspective. I have ran into a problem „trusting“ get_the_ID() in many of these modern themes/builder systems out there because they pass the ID through a series of builder page/templates that obfuscates the „REAL“ ID of the page you think you are on depending on what you are trying to do in-template 

I want to point out that $wp_query->post->ID and get_the_ID() could be cached depending on a verity of themes, theme builder systems, plugins and other settings. the post below using get_queried_object_id works as the most reliable method outside the loop from an „absolute“ perspective. I have ran into a problem „trusting“ get_the_ID() in many of these modern themes/builder systems out there because they pass the ID through a series of builder page/templates that obfuscates the „REAL“ ID of the page you think you are on depending on what you are trying to do in-template 

I want to point out that $wp_query->post->ID and get_the_ID() could be cached depending on a verity of themes, theme builder systems, plugins and other settings. the post below using get_queried_object_id works as the most reliable method outside the loop from an „absolute“ perspective. I have ran into a problem „trusting“ get_the_ID() in many of these modern themes/builder systems out there because they pass the ID through a series of builder page/templates that obfuscates the „REAL“ ID of the page you think you are on depending on what you are trying to do in-template