Just set the image alt text when the image is saved. Hook onto the save_post action, check if any of the attached images don’t have alt text, and if not then generate the alt text you want and save it with:
update_post_meta( $attachment_id, '_wp_attachment_image_alt', 'this is the alt text' );
Related Posts:
- How to Display Image Meta underneath EVERY image in EVERY post
- Show all terms of a custom taxonomy?
- How to update custom fields using the wp_insert_post() function?
- How to paginate a list of custom taxonomy terms?
- Display all meta for a post?
- PHP/Manual use of images? – 2 Questions
- How to use SRCSET with get_the_post_thumbnail()?
- How do I get images (with a thumbnail preview) to show in search results?
- How to get Poster (thumbnail) Image of Video
- Include a specific post to the query_posts and remove it if it is already in the returned list
- How to make thumbnail image fit into a div where image dimentions are completely different?
- Assign a picture URL to a page via PHP
- How to scale image with equal width and height without distortion?
- Featured image fallback link to permalink
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- how to increase custom post value by one most efficiently?
- get_the_terms – only top level
- Get Custom URL For Custom Taxonomy
- get_terms orderby numeric
- Sum custom field values of particular taxonomy
- Echo URL of large version of Featured Image
- Query all posts of a custom taxonomy term
- Trying to add attribute to my posts’ featured image
- Create a hierarchical taxonomy list in WordPress
- WP dynamic featured image – Can’t get second featured image url
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- Sort custom meta column by other meta value
- WP Post-Thumbnail
- Grab posts by multiple categories
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- How to get original custom taxonomy slug after the slug has been rewritten?
- How to get post’s current parent term ID?
- need help with existing code showing subpages
- Custom field values to taxonomy terms
- height should be set to auto to avoid pixelation in the post thumbnail function
- Three Questions with Twenty Eleven theme
- Display related posts without a plugin
- WordPress function and string as variable?
- Querying Database with wpdb
- update_post_meta only updating on last loop of foreach
- working with term_relationships table
- Use get() method to grab all categories and output inside another method
- WordPress loop by meta key that is an array? and how loop multiple arrays
- Show the section only if custom taxonomy was chosen
- Exclude product attributes from taxonomy terms loop
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- fetch woocommerce product with custom taxonomy
- How to add post meta in while loop?
- Add category to post meta
- How to set a featured image (thumbnail) with PHP?
- Order a WP_Query by meta value where the value is an array
- Add a custom class to the body tag using custom fields
- Call featured image url
- How to pick “full/thumbnail” images in the loop?
- Creating a Category Taxonomy
- Unable to Call More than One Meta Box Output
- Hide a div when a custom field is empty
- Post meta select input, if statement
- How to break up php code to avoid echo
- WordPress stripping out custom field tags
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Hi need update in my terms for other taxonomy
- WordPress: Export/Import Yoast meta title & description to custom taxonomy
- Show related products by attribute based and certain conditions
- I can’t set image ad fatured programatically
- Get taxonomy terms that share a common object property
- How to retrieve taxonomy Metabox fields in frontend
- How to update custom fields when post is published?
- Update Images after edit via php
- How to add Text before my Custom Term and hide it when empty
- No more get_option(‘date_time’) in WordPress 5.5?
- Delete post meta by serialized meta value
- How to put 2 php codes in functions.php without site crashing
- How to add WordPress Featured image in tag ..?
- Show a text if the post has written by author user role in WordPress
- Add a default style if no Featured image is selected
- How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?
- How to programmatically set existing image in media library the featured image for a post in wordpress
- Having trouble with customizing blog posts on the home page
- WP post meta – for loop inside for loop
- Reverse Cross-Sells (WooCommerce)
- How to link featured images in single.php for only non-logged-in users?
- Using Sprit-sheet on WordPress categories
- Remove item from post_meta array via AJAX
- Post Meta statement?
- WordPress AJAX load post metadata in modal
- insert thumbnail image from php script
- get_post_meta with variable
- add class to background image
- Custom Taxonomy as Link
- WordPress Rewrite Issue
- News and Featured image
- Saving category as insert post
- Postmeta not saving
- If custom field doesn’t exist, or exists and it’s true show title?
- Overwriting a Shortcode
- How to add together (get the sum) a field from all author’s posts
- Remove default Image Sizes
- Query posts by custom taxonomy slug in WP REST API?
- How to make multiple custom taxonomies sit under custom post type slug?