Can’t get Category link inside get_posts

If you can add your code, It may help for everyone. By reading you question. By default normally that get_category_link is have to work. Just use global $post before your loop. If is not work. What you have to do is.

  1. Grab the category id using your @category variable. (you can use print_r($category); or var_dump($category); after your code $category = get_the_category($post->post_ID);)

  2. Then use get_category_link(pass your grabbed category id)

I’m sure it will work.

For more info. Read this CODEX