Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#37741 closed defect (bug) (invalid)

Class passed in $attr parameter of get_the_post_thumbnail being ignored/not used

Reported by: brs14ku Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Post Thumbnails Keywords:
Focuses: Cc:

Description

Class passed in the $attr parameter not getting applied.

<?php
echo get_the_post_thumbnail( absint( $post_data->ID ), 'full',  array( 'class' => 'card__image' ) ); 
?>

Change History (3)

#1 @brs14ku
5 years ago

I believe this is because of it's use of wp_get_attachment_image which appears to do nothing with 'class' element of the $attr array.

https://developer.wordpress.org/reference/functions/wp_get_attachment_image/

#2 @brs14ku
5 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#3 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted

Could not reproduce on a clean install, your snippet works as expected for me.

Note: See TracTickets for help on using tickets.