title: Wordpress - correct php link for images in media library
body: <p>I'm finalising a wp site I've built on my local server and removing all localhost links. I've added all the_permalink tags for pages but I'm struggling with the links for my <code>img</code> tags. I've tried <code>&lt;?php get_attached_media( 'ID' ) ?&gt;</code> and I've tried <code>&lt;? php wp_get_attachment_link() ?&gt;</code> and <code>&lt;? php wp_get_attachment_image() ?&gt;</code> but none seem to work. </p>
  
  <p>What am I doing wrong? This is the code in my header file, for example, so its all standard code -</p>
  
  <p><strong>header.php</strong></p>
  
  <pre><code>&lt;div class="left-header"&gt;
              &lt;img src="http://localhost:8888/wp-content/uploads/2017/07/Logo.png" alt="logo" id="logo" style="width:250px;height:30px;"&gt;
          &lt;/div&gt;
      &lt;div class="right-header"&gt;
           &lt;div class="right-header-top"&gt;
              &lt;div id="contact"&gt;
                  &lt;img src="http://localhost:8888/wp-content/uploads/2017/07/phone.png"&gt;
                  &lt;p&gt;0113 220 5265&lt;/p&gt;
                  &lt;img src="http://localhost:8888/wp-content/uploads/2017/07/email.png"&gt;
                  &lt;p&gt;hello@media.co.uk&lt;/p&gt;
              &lt;/div&gt; 
  </code></pre>
  
  <p>Pretty much all the images I'm looking to change are in <code>img</code> tags.I'm sure this is a straightforward fix but I'm having a real brain freeze at the moment.</p>