Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#16713 closed defect (bug) (duplicate)

Wordpress removes title attribute from images

Reported by: ukdmbfan Owned by: westi
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Formatting Keywords: dev-feedback has-patch
Focuses: Cc:


For everyone apart from super-admin users, WordPress will remove a title attribute defined in an <img> tag. This is because it's not defined in the /wp-includes/kses.php file as being a valid attribute for <img>.

It may be that WordPress doesn't consider title to be a valid attribute (even though it's a standard W3C HTML attribute) which is fine, but WordPress also provides an input box for the title in the image editing popup, which adds the title attribute to the <img> tag, which then doesn't save for anyone other than a super-admin user (even though all users can save a value in that box).

Attachments (2)

16713.diff (375 bytes) - added by solarissmoke 9 years ago.
16713.2.diff (1.9 KB) - added by solarissmoke 9 years ago.
Allow title attributes in all allowed tags

Download all attachments as: .zip

Change History (9)

#1 @ukdmbfan
9 years ago

  • Cc mattward41@… added

9 years ago

#2 @solarissmoke
9 years ago

  • Component changed from General to Formatting
  • Keywords dev-feedback added; needs-patch removed

Patch adds title to allowed img attributes.

However, the title attribute is allowed anywhere in HTML. Is there any reason why we can't tell kses to allow it on all elements? I can't see any security reason not to let authors use title attributes wherever they like. Something like 16713.2 maybe.

Last edited 9 years ago by solarissmoke (previous) (diff)

9 years ago

Allow title attributes in all allowed tags

#3 @xyzzy
9 years ago

+1 . We've run into this recently and wonder if this will be implemented. thanks!

#4 @westi
9 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Owner set to westi
  • Status changed from new to accepted

Going to look into this.

#5 @jkudish
8 years ago

  • Keywords has-patch added

#6 @nacin
8 years ago

  • Milestone changed from 3.4 to Future Release

#7 @duck_
8 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from accepted to closed

We should fix many standard tags in one go, see #20210.

Note: See TracTickets for help on using tickets.