Prevent function from triggering on current page

If you are using a standard WordPress loop to output the list of posts, you can compare get_the_ID() to get_queried_object_id(), they will be the same for the current post.

tech