the wp_get_post_categories function will return the categories for the first post in the loop not the post the user has just clicked on.
You need to pass the categories from the previous post to use in your custom loop.
the wp_get_post_categories function will return the categories for the first post in the loop not the post the user has just clicked on.
You need to pass the categories from the previous post to use in your custom loop.