[wp-trac] [WordPress Trac] #25021: Improve sanitize_title_with_dashes % removal

WordPress Trac noreply at wordpress.org
Wed Jun 18 23:15:13 UTC 2025


#25021: Improve sanitize_title_with_dashes % removal
----------------------------------------------------+---------------------
 Reporter:  duck_                                   |       Owner:  (none)
     Type:  defect (bug)                            |      Status:  new
 Priority:  normal                                  |   Milestone:
Component:  Formatting                              |     Version:  1.5
 Severity:  normal                                  |  Resolution:
 Keywords:  has-patch has-unit-tests has-test-info  |     Focuses:
----------------------------------------------------+---------------------
Changes (by SirLouen):

 * keywords:  has-patch needs-testing => has-patch has-unit-tests has-test-
     info


Comment:

 == Test Report
 === Description
 βœ… This report validates that the indicated patch works as expected.

 Patch tested: https://github.com/WordPress/wordpress-
 develop/pull/9011.diff

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 7.4.33
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.4.5 / Client: mysqlnd 7.4.33)
 - Browser: Chrome 137.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.2
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Testing instructions
 - Add the code proposed by OP anywhere that can be run
 - For example as the one provided in artifacts, using
 `[sanitize_shortcode]` shortcode somewhere in a post
 - 🐞 Text displayed: `%aa`

 === Expected results
 - Text displayed `aa`

 === Actual Results
 1.  βœ… Issue resolved with patch.

 === Additional Notes
 - This is old, but is still valid.
 - I've patch refreshed, added some unit tests and posted this PR just to
 run the whole testing suite and see if it’s passing.
 - I know that these kinds of regexes are not tasteful, but I see that this
 can move on.

 === Supplemental Artifacts
 Code used for testing:

 {{{
 function sanitize_title_with_dashes_test() {
         $title = '---aa---';
         $sanitized_title = sanitize_title_with_dashes( $title );
         return $sanitized_title;
 }
 add_shortcode( 'sanitize_shortcode', 'sanitize_title_with_dashes_test' );
 }}}

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


More information about the wp-trac mailing list