billerickson / Gallery-Metabox

Displays all the post's attached images on the Edit screen.
33 stars 12 forks source link

HTML In Attachment Description Causes Error With IMG Title #4

Closed wpexplorer closed 11 years ago

wpexplorer commented 11 years ago

Since WP supports HTML in descriptions & the gallery meta box uses the description for the img title it can cause issues if the description does in fact have HTML.

I would simply change line 147:

alt="' . $image->post_title . '" rel="' . $image->ID . '" title="' . $image->post_content . '"

To:

alt="' . $image->post_title . '" rel="' . $image->ID . '" title="' . $image->post_title . '"

PS: It's a great plugin!

billerickson commented 11 years ago

In a previous change request ( http://wordpress.org/support/topic/plugin-gallery-metabox-just-onelittle-additional-feature?replies=5 ) I added the content as the "title" feature so that it would be visible on hover of the image.

I personally don't have a preference of one over the other, but since it's been using the content for a while now and people might be expecting it, I'd rather not change it.

The core issue is that I'm not escaping the values using esc_attr() to prevent undesirable characters. I'll add that right now. Please test and see if this solves your problems.

wpexplorer commented 11 years ago

That does make sense. I personally haven't had any need for descriptions, but I can see why some people might want to show these.