My Custom Post Type single post has a X button which uses history.back();
method to return to the archive page.
<span class="ion-android-close" onclick="javascript:history.back()"></span>
How could I achieve a back button which would remember the correct post anchor so the user would not have to scroll down again to the correct post when clicking back to the archive page?
Sorry for the lack of code, since I haven't found a good and easy solution to implement yet.
Considering your CPT archive should have an ID for each post like this :
You could just change your link in your CPT single template to this (this works only if there is no pagination used on the archive):