This seems to be linked to the issue discussed on this question however it's using cache tags instead of parse and I'm redirecting to a 404.
My code is as follows:
{exp:stash:cache name="page"}
{exp:channel:entries
channel="post"
disable="categories|category_fields|member_data|pagination|trackbacks"
require="yes"
}
{if no_results}{redirect="pages/404"}{/if}
{/exp:channel:entries}
{/exp:stash:cache}
I'm accessing this template from the following URI - /posts/test-post-that-doesnt-exist
This post doesn't exist, however the template still renders and does not redirect as you'd expect with the no_results
tag.
Following the idea on this question I added an empty no_results
and it redirects correctly.
{if no_results}{/if}
{if no_results}{redirect="404"}{/if}
It smells like a prefix issue, if I removed the stash:cache tags it redirects correctly.
Has anyone else has this issue? Is there a work around? Am I missing something (have tried prefix and unprefix parameters on the stash:cache tag).
Ta