Get the link of the first post of a custom taxonomy in a custom taxonomy list

If I understand you correctly, you’re basically wanting to grab one post from each taxonomy term. And then get that post’s link.

WP_Query is your friend here – with a custom query, you can get posts with almost any criteria you want (check the docs I’ve linked to there, they outline almost everything you can do).

The criteria in this circumstance is a total of one post, from a certain term, sorted by whatever you wish to define ‘first’ as (I’m going to assume that means the most recent post).

You’d be looking at something like this:

foreach( $terms as $term ) {

  $the_query = new WP_Query( array( 
    "posts_per_page" => 1,
    "orderby" => 'date', // this is the default
    "order" => 'DESC', // this is the default
    "tax_query" => array(
      array (
        'taxonomy' => $tax, // use the $tax you define at the top of your script
        'field' => 'term_id',
        'terms' => $term->term_id, // use the current term in your foreach loop
      ),
    ),
  ) );

  $pageone = get_the_permalink($the_query->posts[0]);

One thing to keep in mind is that sticking a query within another loop can very quickly become performance intensive, so this won’t necessarily scale if you have hundreds of terms.