Templates without a loop, best practice?

but how does this work without even a call to “the_post()”

Template tags like the_title(), the_content() etc., as well as the ACF get_field() functions, all use the global $post variable to determine which post’s title, content etc. to display (unless a specific ID is specified).

When a WordPress page is loaded, WordPress performs the “main” query, which is what determines which posts will be used in The Loop. It also parses the URL and determines what to query, sends headers, and handles 404s.

The last thing it does though, is assign some global variables. One of those is the global $post variable. This is automatically set to the first post in the query’s results. It also sets a couple of other global variables.

Because the global $post variable is set at this early stage, functions like the ones I mentioned earlier will generally work as expected when on a single page or post, even without The Loop.

The reason this is not sufficient though, is that the the_post() function that is run during the loop does several things that the main query has not already done. This includes:

  • Firing the loop_start action.
  • Iterating to the next post in the loop, when there are more than one.
  • Setting the in_the_loop() to true.
  • Setting several global variables not set in the main query, including: $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, and $numpages.

So if you don’t run while ( have_posts() ) : the_post() then none of the above will happen. In many circumstances, including — apparently — yours, this might not seem to cause any trouble. But any plugins or other functionality that relies on any of the above will probably not work correctly.

is there likely some danger that some future version of WP will break this method of getting post data.

It’s arguably already broken. I would be surprised if there was a change in the short to medium term that would break anything that’s currently working for you (not setting the global $post variable during the main query would likely break many sites), but the only way to be safe is to do things the correct way.