[wp-trac] [WordPress Trac] #54840: wp_insert_term sanitizes attribute names, while term_exists does not before checking names

WordPress Trac noreply at wordpress.org
Mon Jan 17 09:29:16 UTC 2022


#54840: wp_insert_term sanitizes attribute names, while term_exists does not before
checking names
--------------------------+------------------------------
 Reporter:  Dekadinious   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Taxonomy      |     Version:  5.8.2
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by costdev):

 == Test Report

 === Env
 * WordPress: trunk
 * Chrome 97.0.4692.71
 * Windows 10
 * Theme: Twenty Twenty One
 * Gutenberg Editor
 * Plugin: None activated

 === Steps to test
 1. Navigate to `Posts > Categories`.
 2. Insert a category called `X & Y` with the slug `x-y-suffix`.
 3. Add `wp_die( var_export( term_exists( 'X & Y' ), true ) );` into your
 theme's `functions.php` file.
 4. Refresh the page.
 5. Actual output: `NULL`. Expected output: `<the term's ID>`.

 === Cleanup
 ''Must be done before re-testing.''

 1. Navigate to `Posts > Categories`.
 2. Delete the `X & Y` category.

 === Results
 - Issue reproduced ✅

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


More information about the wp-trac mailing list