Just want to get a better understanding of where this is running.
Is this inside the main posts loop? have_posts()
is this in an archive template or a single template? The reason I’m asking is that there is a check for is_single()
which would not be needed on a single post page. So what template file this is running it would make a difference on why there’s an error.