Random post, page inside post loop problem

Assuming you have an original query that is wrapping the code you pasted, it looks like <?php wp_reset_query(); ?> is your issue, but I’m pretty sure you should be able to replace it with <?php wp_reset_postdata() ?> to get back to your original $post variable within the main query.

Leave a Comment