[wp-trac] [WordPress Trac] #51417: TinyMCE stripping <picture> tags

WordPress Trac noreply at wordpress.org
Wed Sep 30 13:58:12 UTC 2020

#51417: TinyMCE stripping <picture>  tags
 Reporter:  Grzegorz.Janoszka  |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Future Release
Component:  TinyMCE            |     Version:  5.5.1
 Severity:  normal             |  Resolution:
 Keywords:  needs-patch        |     Focuses:

Comment (by Grzegorz.Janoszka):

 Yes, the caption shortcode is processed in two places - on the server (PHP
 code) and in the editor (JS). There first one is a similar regex in the
 PHP code of caption wrapper in wp-includes/media.php

 `                if ( preg_match( '#((?:<a [^>]+>\s*)?<img
 [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {`

 This one however can be dealt with by creating your own version of the
 [caption] shortcode. After few minutes of coding you have it done. Of
 course it would be awesome to have it update to accept picture and source
 tags, but we can make do.

 The huge problem is the JS code of the editor which can't be changed at
 all by actions and filters.

Ticket URL: <https://core.trac.wordpress.org/ticket/51417#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list