Support » Requests and Feedback » Extra Filters – thumbnail functions

  • Currently the get_the_post_thumbnail() function applies the post_thumbail_html filter to the result. This lets us alter the return value (either tweak it or replace it completely).

    It would be useful if has_post_thumbnail() had a similar hook. Right now if I want to use the filter to add a default image (say one based on the date of post, or category, or user) when the post itself does not have one there is no way of telling has_post_thumbnail() to indicate that there is actually going to be an image.

    Similarly the get_post_thumbnail_id() could use a filter as well. There are two main reasons for this. Some themes make use of it to directly craft there own html and the ability to hook a plugin at this level would be useful to work with them. Secondly if I’m changing the ID of the image used for the thumbnail via the post_thumbnail_html filter then it would be useful to change the return value here to be in sync.

    In short, can we get filters on:

    • has_post_thumbnail()
    • get_post_thumbnail_id()
  • The topic ‘Extra Filters – thumbnail functions’ is closed to new replies.