The hook post_thumbnail_html
is just working for featured images aka post thumbnails, hence the name. I’m guessing that’s what you’re missing and where the “problem” originates.
But luckily there is another hook for manipulating image tags get_image_tag
, there is actually one for just altering the class get_image_tag_class
too. Take a look into those.
Another hook used in these scenarios is wp_get_attachment_image_attributes
, but I only mention this one for completeness reasons.
Related Posts:
- How do I use element instead of tags in WordPress post content having webP support?
- Show featured image next to post-teasers in Genesis Framework?
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Errors when uploading images in WP 3.5
- Set size for attachments
- Get all images in post and comments like Twitter before post title
- Issue where WP Featured Image will not display
- Remove Featured Image & All Media Uploaded to the Post
- how to give multiple post thumbnails to a post
- How to display post title inside thumbnail?
- Only show featured image on exerpt and exclude images in post
- Delete media from the post but keep my featured image and post
- Thumbnails and images in the blog post are not loading
- Blog featured images disappeared on my homepage
- Center crop the feature image
- Add another feature image box
- How to show category image if no featured image is set?
- Set featured image on creating new post
- Latest news mini images
- Post thumbnail height problem
- Import alt text in set_post_thumbnail
- website images getting corrupt automatically
- How do you add thumbnail support for custom post types?
- removing inline styles from wp-caption div
- Post featured image column on admin post list page
- How to get Images included in Post
- Find the post an attachment is attached to
- Post slugs and images cannot have same name?
- How to add/assign or change featured image in post programmatically?
- Action hook ‘wp’ firing twice… why?
- In what sequence are the hooks fired when a post is “published”?
- Unattaching images from a post
- how to display post content without post image?
- How to change post status from publish to draft using hook in wordpress?
- Load post content into div with ajax
- Showing Thumbnail from Previous and Next Posts
- Custom function for “Submit for Review” hook
- Add an image box besides featured image?
- Remove inline width from figure
- How only display all post related to category
- Does an action fire when adding a tag via the “Tags” meta box?
- Are posts updated or built from revisions + autosaves?
- Remove permalink from images when inserting into post
- Image Insert into posts and pages not working after 3.2.1 update
- Action hook for new pending posts?
- Copying and pasting emoji in a wordpress post
- What is the standard featured image size?
- How to display featured image without it appearing in post?
- Featured Image uploaded, attached and set but only appearing in the media library
- Get all attachment by post excluding featured and content inside
- wp-cli post create & media import issues
- Get attachments for posts that belongs to a specific category
- why are images not full size?
- Post body text occupying featured image space before it loads
- Redirect to another page using contact form 7? [closed]
- Thumbnail Image to go in the post aswell
- Getting only the URL of the post thumbnail
- Adding bootstrap classes to video shortcodes
- related author post thumbnail shows post thumbnail
- Upload attachment from external site
- Get URL from all images in a post
- Disable posts generated from image uploads
- Is it possible to add a shortcode below post title?
- Automatically set post_parent value
- Image behind the post’s title
- Show more than 200 images in one post
- Get featured image on hover of post title [closed]
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- Retrieve a specific post’s featured image and show on a different page
- How to get the next and previous image title from attachment or gallery?
- How to display Post title By ID and its Thumb Contents
- Is there a way to know when a page has been updated and do some action only once?
- unable to write to the database while uploading images
- Restricting displayed posts to posts from only select authors
- Hook when post is set from published to draft?
- Mysql update menu_order problem
- Display image gallery if more than 1 image
- post thumbnails error
- ‘posts’ table should not store the absolute image path
- How to make an image appear as a thumbnail in the blog post?
- Display post on main page with thumbnail
- How can I alternate styling of images in a post? [closed]
- How to force regenerate thumbnails in WordPress posts?
- wp query custom orderby not custom field
- Customizing individual images on posts
- How to remove related post from home page
- Update all images url imported from HTML pages
- Thumbnail With Next/Prev Links Not Showing Next Post?
- Post thumbnail dependant on category
- Which hooks are essential for post templates?
- How do I insert a custom field in a user submitted post?
- Only show posts with image and the correct ammount of posts in loop
- Extra Theme – Fit image inside of Featured Post Slider
- Full width images within post content
- Displaying all images from a WordPress post (including media library)
- How to move all images in a post to a single gallery for a bunch of posts?
- Optimize blog that serves hundred of images and videos