on WordPress Developer Resources website's page related to get_the_ID() function it says:
Retrieves the ID of the current item in the WordPress Loop
But I can use it outside of the loop and it works without using get_queried_object_id() which is apparently recommended in such a case.
Why is that?
(little code snippet to let you understand what I mean):
get_header();
echo get_the_ID(); // Shows the id of currently displayed page.
// Here comes the loop!
$some_query_args...
$some_query_loop {
echo get_the_ID(); // Shows the id of queried page/post.
}
get_footer();