title: wordpress functions.php how to remove link from featured image
body: <p>I notice there are lots of questions regarding removing links from Featured Image in Wordpress. And here's another one which I haven't found an answer to, after days of searching and using trial &amp; error by deleting and modifying the codes.</p>
  
  <p>I would like to remove links that are automatically generated whenever I insert images via Featured Image. As you guessed it, this is done through Portfolio (not Pages or Posts).</p>
  
  <p>I suspect the solution lies within the code below which is extracted from functions.php:</p>
  
  <pre><code>// Get Featured Image + Link
      function get_featured_image( $img_size, $fallback ) {
      global $post;       
  
      $post_hide_featured_single = get_post_meta($post-&gt;ID, 'post_hide_featured_single', true);
      if ( is_single() &amp;&amp; $post_hide_featured_single ) {
          return false;
      }
  
      if ( has_post_thumbnail() ) {                               
          $featured_image_link_to = get_post_meta($post-&gt;ID, 'featured_image_link_to', true);
          $featured_image_link_to_url = get_post_meta($post-&gt;ID, 'featured_image_link_to_url', true);         
          if ( $featured_image_link_to_url ) {
              $featured_image_link = $featured_image_link_to_url;
          }else{
              if ( $featured_image_link_to == 'post' ) {
                  $featured_image_link = get_permalink();
              }else if ( $featured_image_link_to == 'image' || !$featured_image_link_to ) {
                  $featured_image_link = wp_get_attachment_image_src( get_post_thumbnail_id( $post-&gt;ID ), 'full' );
                  $featured_image_link = $featured_image_link[0];                 
              }
          } // end if url set         
          $featured_image = get_the_post_thumbnail($post-&gt;ID, $img_size, array( 'class' =&gt; '' ));
      }else{ // no thumbnail set
          $featured_image_link = get_permalink();
          $featured_image = $fallback;
      } // end if has featured image              
  
      if ( has_post_thumbnail() ) {       
          return "&lt;div class='post-thumbnail'&gt;&lt;a href='" . $featured_image_link . "'&gt;" . $featured_image . "&lt;/a&gt;&lt;/div&gt;";      
      }
  </code></pre>
  
  <p>I have tried deleting the  at the last line, to no avail. I'm thinking maybe its the get_permalink() thing but I am only familiar with html and css.</p>
  
  <p>Any advice or pointers to other resources very highly appreciated.</p>
  
  <p>Thank you very much!
  Dave </p>
  
  <p>ADDITIONAL INFO:</p>
  
  <p>Code used to display image in single-portfolio.php is as follows:</p>
  
  <pre><code>&lt;div class="grid_8"id="aside"&gt;                                      
              &lt;?php
  
                  if ( $portfolio_layout == 'attachment_list' || ! $portfolio_layout ) {
  
                      $gallery_options = array( 'display' =&gt; 'list', 'source' =&gt; 'attachment' );                  
                      echo attachment_gallery( $gallery_options );    
  
                  }else if ($portfolio_layout == 'attachment_slider' ){
  
                      $gallery_options = array( 'display' =&gt; 'slider', 'source' =&gt; 'attachment' );                    
                      echo attachment_gallery( $gallery_options );    
  
                  }else if ( $portfolio_layout == 'video' ) {
  
                      // print_r_pre( get_post_custom() );
                      $embed = get_post_meta( $post-&gt;ID, 'portfolio_video_src_embed', true );
  
                      // If video embed source filled in, use it above all others
                      if ( $embed ) {                     
                          echo do_shortcode( $embed );                        
                      }
  
                  }else{                      
                      echo '&lt;!-- template not found --&gt;';                     
                  }
              ?&gt;              
              &lt;?php wp_reset_query(); comments_template( '', true ); ?&gt;               
          &lt;/div&gt;&lt;!--//grid_8--&gt;   
  </code></pre>
  
  <p>MORE ADDITIONAL INFO:</p>
  
  <p>Below is the code for attachment_gallery:</p>
  
  <pre><code>// Gallery Function (list, gallery, slider, etc...)
  function attachment_gallery( $options ) {
  
      global $post, $wp_query;
      $output = "";
  
      $original_wp_query = $wp_query;
      $wp_query = null;
  
      // Default options, overridden by extract() below if set
      $source = 'attachment';
      $display = 'list';
      $media_size = 'grid_8';
      $slide_effect = '';
      $slide_delay = '';
      $slide_speed = '';
      $slide_nav = '';
      $slide_nav_nextprev = '';
  
      // Extract options from array to variables
      extract( $options );
  
      $args = array(
          'post_parent' =&gt; $post-&gt;ID, 
          'post_type' =&gt; $source,
          'post_mime_type' =&gt; 'image',
          'post_status' =&gt; 'inherit',
          'order' =&gt; 'ASC',
          'orderby' =&gt; 'menu_order',
          'posts_per_page' =&gt; -1
      );
  
      // Run the new query
      $wp_query = new WP_Query( $args );
  
      // Slider wrap
      if( $display == 'slider' ) { $output .= "&lt;div class='slides_container'&gt;"; }
      $slide_counter = 0;
  
      $output .= "&lt;ul class='stripped thumbnail-list clearfix'&gt;"; 
  
  
      if ( have_posts() ) {
          while ( have_posts() ) {            
              the_post();
  
              if ( $slide_counter &gt; 0 &amp;&amp; $display == 'slider' ) { $output .= "&lt;li class='hidden'&gt;"; }else{ $output .= "&lt;li&gt;"; }
  
                  $output .= "&lt;div class='content'&gt;";
                      if ( $source == 'attachment' ) {
                          $post_thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post-&gt;ID ), 'full' );
                          $output .= "&lt;div class='post-thumbnail'&gt;&lt;a href='" . $post_thumbnail_src[0] . "'&gt;";
                              $output .= wp_get_attachment_link($post-&gt;ID, $media_size, false, false);
                          $output .= "&lt;/a&gt;&lt;/div&gt;";
                      }
                      if ( $source == 'slider' || $source == 'post' || $source == 'portfolio' ) {
                          $output .= get_featured_image( $media_size, '' );
                      }
                  $output .= "&lt;/div&gt;&lt;!--//content--&gt;";
  </code></pre>