How can one determine if a view is empty using views_embed_view()? I need to add a header to the page markup if a call to views_embed_view() retrieved any content, and hide it if not. Unfortunately, an empty view produces this markup:

&lt;div class="view view-related-content view-id-related_content view-display-id-block view-dom-id-a62e1bda4cd2427adcbfba7ad95dec6e"&gt;









&lt;/div&gt;


(I've left the spacing in to be as accurate as possible).

The view is set to hide results when the argument for the (only) contextual filter is not present.

How can I determine whether the view actually has any results, without incurring any extra DB overhead?

I'm looking to do this just with API functions as overriding templates for something so trivial is not palatable. I'm also not looking for any hacks (e.g. measuring the length of the return string and hiding the header based on that).
You could use views_get_view_result() which returns an empty array if the view has no result to display.