I have next code on my single page.

  $('.cross').on('click', function(){
    var toPrevPage = $(this);
        toPrevPage = history.back();

When you go to single page through urlOfsite/ => urlOfsite/category => urlOfsite/category/singlePage and then click on cross - you will be returned to the category from which you came, but when you go to single page through direct link - the cross does not return to the previous category.
Why does this happen and how can I fix it?

live example

Read more here: Return to previous category from single page


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: