• Hi!

    Well, I managed to link the Feature Image to it’s permalink with this code in functions php:

    add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
    
    function my_post_image_html( $html, $post_id, $post_image_id ) {
    
      $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>';
      return $html;
    
    }

    How should I modify it if I want to link the to an external url?

    Thanks for your ideas!!

    Carlos

    [Moderator note: Please don’t bump]

  • The topic ‘Link Feature Image to external url’ is closed to new replies.