Maybe not the best solution, but did it like this:
function add_alt_tags($content)
{
global $post;
$content = str_replace('alt=""', 'alt="'.$post->post_title .'"',
$content);
return $content;
}
add_filter('the_content', 'add_alt_tags', 100);
Related Posts:
- Filter to remove image dimension attributes?
- Change WordPress image URLs via filter
- Why should I use “Organize my uploads into month- and year-based folders” option? (Cons/Pros)
- Always use for post images
- Change html structure of all img tags in WordPress
- Default Image Link Removal
- Remove title attribute from images
- hook into completed image upload filter
- Need help building a filter to edit the output of “image_send_to_editor”
- Filter Media Library by author or post_parent
- Preview Image Path in Admin Section
- How to display a shortcode caption somewhere other than the_content
- Alter image output in content
- How can I remove the image attachment ALT field?
- how to base64 encode images in wordpress template
- add data-attribute to all images inside the_content()
- Filter to modify post_title after image upload?
- Change html structure of all img tags in WordPress
- Disable wordpress image sizes generation
- Extend core block attributes in post content
- What’s the proper way to use the get_image_tag filter?
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- add the post as canonical for attachment page wordpress
- How to get image ID to use inside wp_read_image_metadata()?
- SEO images in Nextgen Galleries
- alt tags of the images are not saving/emtpy
- SEO – Media File Name Updating
- Is there any action/filter hook to use when an image gets edited in the editor?
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- How to add custom classes to figure element only if image has caption?
- Change align classes for images
- How to filter the image embed code based on link type
- Add custom text in the media library image meta area
- WP 5.3 Removing Default WordPress Image Sizes
- Facebook og:image issues after https change [closed]
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Bulk Upload Image Alt Text
- Remove Image Sizes in Media Settings Page
- How can I use wp_save_image_editor_file filter?
- How to stop WordPress from completely overriding my tags in my templates?
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Prevent WP from wrapping html in caption shortcode after ‘image_send_editor’ filter is applied
- How can I change the to for lazyload wp smilies
- How to display a warning when an uploaded image is too small?
- How to change an image source when rendering on frontend?
- How to change Gallery image url in product page ? In function.php?
- How to get title of images in post content
- Change Image in Mobile Search Results
- How to avoid images appear as post in google search?
- How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?
- js alert in add_filter function for image_send_to_editor
- Dinamically modifying attributes of images on posts
- How to attach post ID to image links in WordPress tinymce editor
- image_send_to_editor filter – Unwanted paragraphs and line breaks
- How might one programmatically set the link for all images in all posts?
- Image filter works on attachement pages but not posts. I can’t get the image ID
- Surround uploaded image link with div
- Removing image dimensions from `the_content`
- Rename uploads filenames to POST-ID on upload
- Img alt tag showing different value then entered
- I tried to move the featured image below the paragraphs but now it is displaying twice
- How to add a link to media file for every image inserted in content?
- Set default image sizes in WordPress to hard crop
- How to find attachment by it’s name?
- How to disable “insert into post” only when selecting the Featured Image?
- Is there a way to define a default caption to all uploaded images
- How can I add the “Use as featured image” to a custom metabox?
- How to place an image into header.php? [closed]
- Uploading an image as featured image from frontend form
- @wordpress/create-block image url in css
- How does WordPress work out the srcsets?
- Remove ‘wp-content/themes/themename/’ from Image path
- help getting featured image using get_posts
- Why can I not view image attachment pages?
- Restrict Image Uploads to a Certain File Type
- How to display alt tags in img src?
- How to add image and featured image to post by WP REST API
- Jetpack’s photon causes local site to try and serve images from WordPress CDN [closed]
- How to stop wordpress always displaying full-res images
- Transfer only original images to new site
- Conditional Image Sizes for Use via Theme Customizer Upload Only
- Rewrite all article pictures to link to file
- Upload box media size not working
- Featured images disappear after DB export/import?
- When does WP resize an image file
- Changing Image Size Settings does not show in Image Details
- Get the URL, width and height of an image where the width and height are a specified minimum
- Metabox image upload value
- Is there a layout to place 2 same sized images in two columns on the WordPress page?
- How can I change the header on the pages?
- Image links broken / “DNS Update Required” message
- Convert multiple image blocks to gallery block in Gutenberg?
- WordPress After migration some images src is empty
- Image sizes reset when changing theme
- How to get featured image of last post in a category?
- How can I add “alt” tag to element?
- How to make Facebook share the featuterd image from url on WordPress
- can’t output gray scaled image I’ve created using add_image_size
- Images not rendering
- Specify what to do for a specific image number of the post