Allow get_the_post_format_image to return image without link
|Reported by:||tollmanz||Owned by:|
When a user adds a link to an image post in the new post format UI, the_post_format_image() and get_the_post_format_image() functions will always return the image HTML wrapped in the link.
There are a number of cases in which a theme or plugin author may want to get the image without the link. For example, the author might want to wrap both the image and the title in a link. Having a link wrapped around the image complicates this.
I think we should either add a new parameter that allows the image to be returned without the link, or create two functions: one that returns the image with the link and one without the link. I personally find it a little misleading to use a function called the_post_format_image() and get an image wrapped in a link.
Separating functions that allow for returning just the image and the image with the link is important for flexibility. I think that wrapping the image in a link is making a decision that the developer should make and is limiting the developer without good reason. This will lead to some weird workarounds that will decrease the stability of community code. Having two functions instead of one does not increase complexity, yet it improves the flexibility of the API.
I'm happy to work on this if people think it's worth adding.