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
- Trying to alter the post_content through the_post
- If statement to check if post has image
- Gather posts into a cart/lightbox and share with another user
- Call Web Services on post first publish
- How to check if single.php has already called the_post_thumbnail function
- Thumbnail Image to go in the post aswell
- Getting only the URL of the post thumbnail
- How to dynamically parse and transform post/page content before displaying it?
- Get Post’s first image using Short-code
- What does WordPress do if I save a post without content/title? [duplicate]
- Adding bootstrap classes to video shortcodes
- related author post thumbnail shows post thumbnail
- What are the benefits of setting a “featured image” for a WP blog post?
- Admin – no Featured image choice in create new/page|post
- Post Image not displaying in category view
- update image path with words starting uppercase to lowercase chars
- why the same code got different results when using query_posts in functions.php and index.php
- Divs appearing everywhere in post content
- How to only publish posts with image in it
- Modify posts listing at back end
- Uploading images in custom post form
- Upload attachment from external site
- Make insterted image point to post url instead of attachment page
- Get URL from all images in a post
- Disable posts generated from image uploads
- Hook for changing excerpt content when excerpt not set
- Is it possible to add a shortcode below post title?
- Posts page not showing correct image
- Images showing up in Post Editor, but not in Published Post
- How to allow multiple thumbnail upload for Posts?
- Automatically set post_parent value
- Image behind the post’s title
- Using wp-cli and delete everypost first image
- get_children returns older images
- How to remove text and retain in caption image using the_content function
- How to retrieve certain number of images from a wordpress post?
- Post Title to featured Image ALT
- Show more than 200 images in one post
- How to get all inline images in post content? [duplicate]
- 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
- Change the background of each post according to the category
- How to Featured content with images in home page?
- Remove Featured Image from posts in specific category?
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- How to show a featured image inside a post in only 1 single category
- Inserting Media to WordPress Posts
- Author Avatar as default first image
- Retrieve a specific post’s featured image and show on a different page
- Link post images to post
- How to get the next and previous image title from attachment or gallery?
- Attachment image single page
- How to change the order of elements within a post?
- WordPress as CMS: How to manage/handle images assigned to a post as full-sized background images in a slideshow?
- How to display Post title By ID and its Thumb Contents
- How to call WordPress First Image Post or else Attached Image or Default
- Regarding Posts
- how can display a post on home screen without images
- attach several images to post + gallery
- Changing The Default Header POST Title and Description text by category in wordpress
- Site/Post preview is not working on all social media
- How to exclude native lazy loading from first image in post content?
- Rewrite image links from attachment id to attachment link
- Posting to WP via URL
- Is there a way to know when a page has been updated and do some action only once?
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- unable to write to the database while uploading images
- Restricting displayed posts to posts from only select authors
- How can I change the date format of the revision list?
- Featured image error after importing blog posts
- Pinterest button shows image options from different posts
- Change the size of the featured image for post?
- Hook when post is set from published to draft?
- Mysql update menu_order problem
- Is update_post_meta used when save_post action hook is invoked?
- Display image gallery if more than 1 image