I have following code

    &lt;?php

      $args = array(
   'post_type' =&gt; 'attachment',
   'numberposts' =&gt; 12,
   'post_status' =&gt; null
  );

  $attachments = get_posts( $args );
     if ( $attachments ) {
        foreach ( $attachments as $attachment ) {
           echo '&lt;li&gt;&lt;a href="'.get_permalink( $attachment-&gt;ID ).'"&gt;';
           echo wp_get_attachment_image( $attachment-&gt;ID, array('100', '100') );
          echo '&lt;/a&gt;&lt;/li&gt;';
          }
     }

?&gt;


The point of this script is to show last added 12 photos (thumbs of it). And this works perfect. But I want to add second funcionality - link to the page where it comes from (usually native gallery embed into post/page)

The problem is that in this case the link is corrupted. It always links to the very first post. What I am doing wrong?


Question: cURL is unable to use client certificate , in local server
Answer: The key must be a filename, not a passphrase.