admin管理员组文章数量:1333164
I'm looking for a way to regenerate all images in media library and set ALT and TITLE to those that missing.
Something like what this plugin do + what I mentioned.
All codes people prepared are for set it WHILE UPLOADING image, not for images are already in media library, like this one:
/
changing titles/alt-text for previously uploaded images is a COMPLETELY different problem than what the code in this post aims to solve, because of the way WordPress handles images that are inserted into posts/pages.
The key point regarding previously uploaded images is that when you insert those images into a post/page, the image title and alt-text are COPIED into the html of the post/page by WordPress. So if you subsequently change the title/alt-text of the image in the media library, it will NOT affect any post/pages where that image is displayed, since the title/alt-text of the image was copied over into the post/page (and therefore will NOT be refreshed with the new image/alt-text from the media library).
Any updated image title/alt-text in the media library will only appear on posts/pages when the image is inserted into the post/page AFTER the title/alt-text was updated in the media library.
any idea will help.
I'm looking for a way to regenerate all images in media library and set ALT and TITLE to those that missing.
Something like what this plugin do + what I mentioned.
All codes people prepared are for set it WHILE UPLOADING image, not for images are already in media library, like this one:
https://brutalbusiness/automatically-set-the-wordpress-image-title-alt-text-other-meta/
changing titles/alt-text for previously uploaded images is a COMPLETELY different problem than what the code in this post aims to solve, because of the way WordPress handles images that are inserted into posts/pages.
The key point regarding previously uploaded images is that when you insert those images into a post/page, the image title and alt-text are COPIED into the html of the post/page by WordPress. So if you subsequently change the title/alt-text of the image in the media library, it will NOT affect any post/pages where that image is displayed, since the title/alt-text of the image was copied over into the post/page (and therefore will NOT be refreshed with the new image/alt-text from the media library).
Any updated image title/alt-text in the media library will only appear on posts/pages when the image is inserted into the post/page AFTER the title/alt-text was updated in the media library.
any idea will help.
Share Improve this question asked Feb 3, 2018 at 21:40 AminoAmino 3232 gold badges5 silver badges17 bronze badges2 Answers
Reset to default 4Full disclaimer, I am the author of the WordPress plugin I am about to mention and I am hoping this answer would give it more visibility.
So, I had to do this for a few clients last year mostly for SEO reasons and it was getting ridiculous. I made a WordPress plugin that can do just what you asked. Bulk update all WordPress image attributes in one go. You can find it here: https://imageattributespro
What it does is, it goes image my image, finds all the posts where the image is inserted into and then updates the alt text and image title right within the post.
Uses WordPress functions to do all these, so never had any issue like a corrupt database or anything. But obviously its a good practice to backup your db before you update anything in bulk.
There is option to update only what isn't already updated, so for all the images that you have custom stuff already in place, they won't be affected at all.
You can see a video of this in action:
https://youtu.be/Z0zVaqqE7iE
Hope that helps. If you have questions, do let me know :)
To fill all alt meta with title you can use following MySQL script in phpMyAdmin:
INSERT INTO wp_postmeta (meta_id, post_id, meta_key, meta_value)
SELECT '', p.ID, '_wp_attachment_image_alt', p.post_title FROM wp_posts p
WHERE p.post_type = 'attachment'
You should remove all _wp_attachment_image_alt entries first to prevent duplicates.
本文标签: pluginsRegenerate images with automatic ALT and TITLE attributes
版权声明:本文标题:plugins - Regenerate images with automatic ALT and TITLE attributes 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742352145a2458707.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论