title: Passing array data to a variable in a loop
body: <p>How do I pass the contents of the <code>$the_slug</code> to the <code>$post_name</code> variable in the loop?</p>
  
  <pre><code>$tags = get_the_tags();
  foreach ($tags as $tag){
  
  global $post;
  $the_slug = $tag-&gt;slug; //contains 10ish words that associate with my permalinks: welcome, home, about, contact, etc
  
  $post_id = 'welcome';
  $post_name = $the_slug; //fails to populate here
  $queried_post = get_post($post_name); //if changed to $post_id works but only 'welcome' post
  $excerpt = $queried_post-&gt;post_excerpt;
  $excerpt = apply_filters('the_content', $excerpt);
  $excerpt = str_replace(']]&gt;', ']]&gt;', $excerpt);
  echo $excerpt . "\n\n";
  }
  </code></pre>
  
  <p>Thanx for looking.</p>