Thanks, the ability to copy alt text from Media Library source images to the image links on specific pages is very helpful. But sometimes I have many images on a page, some already having alt text specific to that page; others I would like to update from the Media Library. An option to tell the tool not to alter images with non-empty alt text would be even more helpful.
Thanks for an interesting suggestion. I’ve done something like that for other example plugins but hadn’t thought about it for Insert Fixit.
I will investigate the work required and post an update here when I have progress to report. Thanks for finding and using the example plugin and for your interest in MLA.
Thanks very much! Another thought: I think what would really work for me is an option to propagate the alt text from a single Media Library item to all page images of that item (again with a no-clobber option). Otherwise, you’d only get to do “no-clobber” once (if all your Media Library items have alt text).
P.S. I’d find the label “example plugins” easier to understand if it was “helper plugins”. I don’t see that they’re an example of anything!
Thanks for your update with the additional thoughts.
You asked for “an option to propagate the alt text from a single Media Library item to all page images of that item“. Let me draw your attention to the four text boxes at the top of the page, where it says:
Enter first and (optional) last ID values above to restrict tool application range. To operate on one ID, enter just the “First ID”. The default is to perform the operation on all posts/pages and all Media Library items (attachments).
If you enter the ID of the single Media Library Item in the “First Attachment ID” text box, leaving the other three boxes blank, you will accomplish your goal.
You observed “I’d find the label “example plugins” easier to understand if it was “helper plugins”.” The Example Plugins were started years ago, and most of them are examples of what you can do with some PHP code that use the hooks built into MLA. A few, such as MLA Insert Fixit, are simply tools motivated by support topics like this one. The term “Example Plugin” occurs hundreds of times in the MLA documentation and support topics. I think changing it at this point would be hopelessly confusing. If I had it to do over again I’d make a different choice.
Now for the good news. I have uploaded a new MLA Development Version dated 20230723 that includes an updated MLA Insert Fixit example plugin. You can find step-by-step instructions for using the Development Version in this earlier topic:
Once the Development Version is installed you must install (or update) and activate the example plugin. Navigate to the Settings/Media library Assistant Documentation tab and click the “Example Plugins” button. Type “fixit” in the text box and click “Search Plugins” to filter the table.
You are looking for the “MLA Insert Fixit” example plugin. Find that plugin and hover over the title in the left-most column. Click the “Install” (or “update”) rollover action, then go to the WordPress Plugins/Installed Plugins submenu and activate the example plugin as you would any other plugin. Make sure you have the latest version, 1.26, installed.
Once the Development Version and updated example plugin are installed and active you will find a new “Replace existing ALT Text values” checkbox just above the two ALT Text copy tools. The default is checked to preserve existing behavior but you can uncheck the box to get the “no clobber” results you seek.
This update will be part of my next MLA version, but in the interim it would be great if you could install the Development Version and the updated example plugin and let me know if it works for you. Thanks for inspiring this MLA improvement.
Thanks very much again! Sorry for the delay in my response — the notification of your post went into my spam folder. I will give it a try ASAP (which will be tomorrow at this point…)
Sorry for the additional delay. I did miss that “Attachment” means “Media Library Item” — apparently that’s WordPress’s convention, but it wasn’t obvious to me, at least. Perhaps the label could be “ID of first Media Library Item (Attachment)”.
Figuring out the Attachment ID is not straightforward. In the Media Library, “Attachment File Metadata” says “Post_id => 15599”, and the URL for that page is …/post.php?post=15599&action=edit. So 15599 must be it. Some direction to this — as provided with posts — would be helpful.
However, with First Post/Page ID specified and First Attachment ID specified, whether or not the new “Replace existing…” checkbox is checked, I get “matched 0… to 0… 0 updates”.
Even without the Attachment ID (just a single page ID), I still got all-zero results. This is something that worked previously, so I suspect all is not well. I *think* I installed your development version correctly… Let me know if there’s some debugging output I can produce…
Thanks for taking the time to install the updated plugin and give it a test.
You wrote “Perhaps the label could be ‘“’ID of first Media Library Item (Attachment)’”’.” The help text below the labels contains your suggested text “all Media Library items (attachments).” I try for short labels when fitting several in a small area.
You wrote “Figuring out the Attachment ID is not straightforward.” The Media/Assistant submenu table has an “ID/Parent” column, enabled by default, that should simplify things. Your Attachment File Metadata suggestion is a good one, too.
You wrote “with First Post/Page ID specified and First Attachment ID specified“. I want to make sure I understand the values you are entering. The “First Attachment ID”, e.g., 15599, would be the ID of a Media Library item. The “First Post/Page ID” would be the ID of a post or page in which the attachment might be found in the post/page content. Normally you would leave this field blank to look for the attachment inserts in all of your posts and pages. If you enter an ID in this field, the tool will try to match the attachment to insert(s) in the content of the single post or page having that ID. Is that what you are attempting? If you see “matched 0 posts/pages…” it means that no post or page was found with the ID you entered.
Let me know if that makes sense. If I did not understand what you are doing, any additional details will be helpful.
I did see later that the “help text below the labels contains your suggested text”; that didn’t prevent “I did miss that ‘Attachment’ means ‘Media Library Item'”.
Your understanding is correct. I’m just trying to update one page — which seems like a good idea when testing a “noclobber” option!
Perhaps it didn’t find that page because it is “Private”?
A different issue: the “Inserted in” field for all images is “Disabled”.
Thanks for clarifying your tests, and for finding the answer to your problem as well. You’re right, “Perhaps it didn’t find that page because it is “Private”?” The current version of the plugin only operates on posts/pages with
post_status = 'publish'. Private posts, draft posts and other post_status values are excluded.
You can see that I added a
post_type(s) text box a while back; I’ll add a
post_statustext box for applications like yours. In the interim, perhaps you can run a test on one of your published posts. I will post an update when I have progress to share.
Regarding the “Inserted in” column/field, the default setting is disabled because the “where-used” features can have significant performance impacts on larger sites. You can enable it easily:
- Navigate to the Settings/Media Library Assistant General tab.
- Scroll down to the “Where-used Reporting” section.
- In the “Inserted in” dropdown control, select “Base” or “Enabled”, depending on the level of precision you need.
- Scroll to the bottom and click “Save Changes” to record your new settings.
I have uploaded a new MLA Development Version dated 20230731 that adds a
post_statustext box to the MLA Insert Fixit example plugin. You can Install the Development Version and update the example plugin by following the instructions in my earlier post. Make sure you have the latest version, 1.27, installed.
Once the Development Version and updated example plugin are installed and active you will find a new “Post Status(es)” text boxjust below the existing “Post Type(s) box. The default is “checked”publish” to preserve existing behavior.
I hope that makes your testing easier. Let me know how it works for you.
Great, thanks much. The update worked nicely! The unchecked “Replace existing” box also worked well, except for this case: alt=””, which was replaced with the alt text from the Media Library. I would prefer that it NOT do that, even with null alt text; null alt text is recommended for “decorative images” (see W3C accessibility initiative). But others may have a different preference! At any rate, decorative images are relatively rare for me.
Thanks again, this definitely helps a lot, and we can start using it. I’m sure you have more than enough to do, but I’ll make another suggestion in case it strikes you as interesting/worthwhile. The identification of posts and images by their IDs is a bit of work; I can’t imagine that ranges of IDs (first-last) would ever be useful. I’m a fan of select2, the jQuery-powered select box that can handle autocomplete and multiple selects. This would be very nice for specifying sets of posts and images to update – by page title, or image name/URL.
Thanks for testing the update and confirming its utility.
You wrote “The unchecked “Replace existing” box also worked well, except for this case: alt=””, which was replaced with the alt text from the Media Library.” In your first post that opened this topic you wrote “An option to tell the tool not to alter images with non-empty alt text would be even more helpful.“
Another way of stating your original request is “an option to tell the tool to only alter images with empty alt text”. It seems to me that the alt=”” case qualifies as empty alt text. I can’t think of a way to reliably tell which images have “null” alt text that should be preserved from images which have “empty” alt text that should be replaced.
You wrote “I can’t imagine that ranges of IDs (first-last) would ever be useful.” One example of how this is useful – process all of the images added since a particular date, e.g., in the current month. Since IDs are assigned in ascending order, it’s an easy proxy for a date range.
I have released MLA version 3.10, which contains the enhancements required for this topic.
I am marking this topic resolved, but please update it if you have any problems or further questions regarding the MLA Insert Fixit example plugin. Thanks for inspiring this MLA enhancement.
- You must be logged in to reply to this topic.