0

I want to insert a link inside a tag page that will link to another page tag.

This is the code (on the answer paragraph): I'm trying to implement the solution found here.

This is the code:

<?php 
  $tags = get_the_tags(); 
  if( $tags ){
    foreach( $tags as $tag ) { 
      ?>
      <a href="<?php echo get_tag_link($tag->term_id); ?>">
        <?php echo $tag->name; ?>
      </a>
      <?php 
      break; 
    } // foreach
  } // endif 
?>

However, the code is always picking the same tag for linking the page tag to another page tag.

I would like to modify the code so it will randomly pick the tag and link to it.

Is there a way to do this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.