[wp-trac] [WordPress Trac] #10928: Canonical Post Thumbnails

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 14 21:52:01 UTC 2009

#10928: Canonical Post Thumbnails
 Reporter:  markjaquith     |       Owner:  markjaquith
     Type:  task (blessed)  |      Status:  new        
 Priority:  high            |   Milestone:  2.9        
Component:  Media           |     Version:             
 Severity:  normal          |    Keywords:             

Comment(by scribu):

 If you wanted to change the class attribute, this is what you'd have to
 write, with the current hooks:

 add_action('begin_fetch_post_image_html', 'begin_post_image_hook');
 add_action('end_fetch_post_image_html', 'end_post_image_hook');
 function begin_post_image_hook() {
   add_filter('wp_get_attachment_image_attributes', 'post_image_hook');
 function end_post_image_hook() {
   remove_filter('wp_get_attachment_image_attributes', 'post_image_hook');
 function post_image_hook($attr) {
   $attr['class'] .= ' alignright';

   return $attr;

 It works, but it's kind of verbose.

Ticket URL: <http://core.trac.wordpress.org/ticket/10928#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list