[wp-trac] [WordPress Trac] #54614: no_texturize_shortcodes filter broken in WP 5.9 beta 1 and 2

WordPress Trac noreply at wordpress.org
Tue Dec 14 12:07:51 UTC 2021


#54614: no_texturize_shortcodes filter broken in WP 5.9 beta 1 and 2
-------------------------------+------------------------------
 Reporter:  pgn4web            |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Shortcodes         |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by pgn4web):

 Thanks @hellofromTonya for looking into this issue.

 My shortcode comes from the embed-chessboard plugin, all details including
 full source code available on https://wordpress.org/plugins/embed-
 chessboard/

 I originally coded and currently maintain the plugin. It works without any
 texturize related problems on the current release of wordpress. My demo
 site http://pgn4web-test.casaschi.net/wordpress/ is on wordpress 5.8.2, no
 issues there.

 I tested the plugin against wordpress 5.9 beta 1 and beta 2. I did a new
 fresh install with no other plugin other than what comes with the
 wordpress download file and added my embed-chessboard. I used the default
 wordpress theme.

 The shortcode code is relatively complex (it displays a chessboard with
 chess moves from chess moves text) however, long story short, if the text
 between the shortcode tags is like this:

 {{{
 [Event "World championship"]
 [Site "Moscow URS"]
 [Date "1985.10.15"]
 [Round "16"]
 [White "Karpov"]
 [Black "Kasparov"]
 [Result "0-1"]

 1. e4 c5
 }}}

 then the plugin code receives this text instead, please note the change in
 the quotes characters (from " to “ and ”) that makes my plugin fail in
 showing the chess games properly:

 {{{
 [Event “World championship”]
 [Site “Moscow URS”]
 [Date “1985.10.15”]
 [Round “16”]
 [White “Karpov”]
 [Black “Kasparov”]
 [Result “0-1”]

 1. e4 c5
 }}}

 I remember seeing this behaviour when originally coding the plugin; this
 was fixed by the following code in the plugin in order to avoid
 texturization of the text within the shortcode tags:

 {{{#!php
 <?php
 function embedchessboard_no_texturize( $shortcodes ) {
   $shortcodes[] = 'pgn';
   $shortcodes[] = 'pgn4web';
   return $shortcodes;
 }

 add_filter( 'no_texturize_shortcodes', 'embedchessboard_no_texturize' );
 }}}

 The code above works in wordpress 5.8.2 but does not seem to work in
 wordpress 5.9 beta 1 and beta 2. As a further proof, if I comment out on
 the 5.8.2 site the add_filter() instruction above, then the 5.8.2 site
 behaves exactly like the 5.9 betas. This confirms to me that the
 no_texturize_shortcodes filter in my plugin does not work with the 5.9
 betas while it works with 5.8.2 and earlier.

 If you'd like to reproduce the issue, you could:
 1) install and activate the embed-chessboard plugin, it's on the wordpress
 plugin repository
 2) create a new post, including the following shortcode:

 {{{
 [pgn initialHalfmove=16 autoplayMode=none]

 [Event "World championship"]
 [Site "Moscow URS"]
 [Date "1985.10.15"]
 [Round "16"]
 [White "Karpov"]
 [Black "Kasparov"]
 [Result "0-1"]

 1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5. Nb5 d6
 6. c4 Nf6 7. N1c3 a6 8.  Na3 d5 9. cxd5 exd5 10. exd5 Nb4
 11. Be2 Bc5 12. O-O O-O 13. Bf3 Bf5 14.  Bg5 Re8 15. Qd2 b5
 16. Rad1 Nd3 17. Nab1 h6 18. Bh4 b4 19. Na4 Bd6 20. Bg3  Rc8
 21. b3 g5 22. Bxd6 Qxd6 23. g3 Nd7 24. Bg2 Qf6 25. a3 a5
 26. axb4 axb4  27. Qa2 Bg6 28. d6 g4 29. Qd2 Kg7 30. f3 Qxd6
 31. fxg4 Qd4+ 32. Kh1 Nf6 33.  Rf4 Ne4 34. Qxd3 Nf2+
 35. Rxf2 Bxd3 36. Rfd2 Qe3 37. Rxd3 Rc1 38. Nb2 Qf2
 39. Nd2 Rxd1+ 40. Nxd1 Re1+ 0-1

 [/pgn]
 }}}

 You should see a chessboard but if you try clicking on the moves text the
 position of the chess pieces does not change. Compare for example with my
 demo site at http://pgn4web-test.casaschi.net/wordpress/

 Hope this helps. Please let me know if you need any more help with this
 issue.

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


More information about the wp-trac mailing list