[wp-trac] [WordPress Trac] #39030: Pass post object or post ID to post_thumbnail_size filter

WordPress Trac noreply at wordpress.org
Fri Dec 2 16:47:44 UTC 2016


#39030: Pass post object or post ID to post_thumbnail_size filter
-----------------------------+-----------------------------
 Reporter:  wido             |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Post Thumbnails  |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:  template         |
-----------------------------+-----------------------------
 As per title, an edit to the filter '''post_thumbnail_size''' as follow:


 {{{
         /**
          * Filters the post thumbnail size.
          *
          * @since 2.9.0
          *
          * @param string|array $size The post thumbnail size. Image size
 or array of width and height
          *                           values (in that order). Default
 'post-thumbnail'.
          * @param WP_Post $post The post object
          */
         $size = apply_filters( 'post_thumbnail_size', $size, $post );
 }}}

 In this way we can retrieve additional info by the post to filter the size
 of the post outside of a loop.

 Yes, there is a filter named '''post_thumbnail_html''' but in that case
 the purpose of the filter is to filter the html string.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39030>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list