[wp-trac] [WordPress Trac] #65315: Inserting the same image with different captions on the same page results in figcaptions with duplicate `id` elements.

WordPress Trac noreply at wordpress.org
Fri May 22 07:54:18 UTC 2026


#65315: Inserting the same image with different captions on the same page results
in figcaptions with duplicate `id` elements.
---------------------------+-----------------------------
 Reporter:  SteelWagstaff  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Media          |    Version:
 Severity:  normal         |   Keywords:
  Focuses:  accessibility  |
---------------------------+-----------------------------
 In core WordPress, using the visual editor, when a user uploads an image
 to the media library and inserts it in a chapter, they have the option to
 provide a caption.

 WordPress renders media with captions as <figure> and <figcaption>
 elements. If the same image is included multiple times in a chapter, the
 figcaptions all include the same id referencing the unique WP attachment
 number, even if the caption content is different. This poses a problem,
 since HTML expects ids to be unique on a given page. We should avoid
 accidentally creating an accessibility issue in the rare (but valid)
 situations where they want to include the same image with different
 captions on the same page.

 I'm willing to open a patch to change the figcaption to a class.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65315>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list