I'm trying to retrieve the current URL of the page, which works everywhere except for archive pages, for example, a category page. On a category page, it shows as the most recent post in that category.
$this_id = $wp_the_query->get_queried_object_id();
$this_url = get_permalink($this_id);
echo $this_url; // Should show like: http://domain.com/blog/category
How do I retrieve the actual archive page URL?