Accessing post’s meta data based on user’s click of a post

One option could be to use data attributes on the entires listed on pages one and two. Then attach a click event that reads the attribute value on click saves it to localStorage. This way you wouldn’t need to make an extra db call on page three.

In the loop the data attribute value can come basically from anywhere. E.g. post meta, some post field, taxonomy or taxonomy term.

<?php while (have_posts()) : the_post(); ?>

  <article class="entry" data-my-attribute="save-me-to-localstorage-onclick">
    <!-- gallery image -->
    <a><!-- link to next page/view --></a>
  </article>

<?php endwhile; ?>