I want to add a new class to the
<a> that gets generated around an
<img> when it's inserted into a post, but only if the link type is set to "Media File".
I see that similar info is available to us in the
image_default_link_type setting, where we can specify
attachment. So it would seem that these are the keywords used by WordPress.
The only hooks/filters I've found so far are either performed on the "Add/Insert Media" popup itself, or on the content that was generated after being inserted into the post. At this point we usually only have access to the generated URL as a string, and no additional info about its link type.
So is there a way to retrieve the link type and filter the output, either as it's being added to TinyMCE (preferably) or as the post content is being output?
- I should add, I'm trying to avoid working with the
hrefas a string because there is no foolproof way to figure out exactly which link type was used to generate the URL.