Make WordPress Core

Opened 2 months ago

Last modified 8 weeks ago

#60878 new defect (bug)

We need to add trim validation on Add New Category name

Reported by: sumitsingh's profile sumitsingh Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-screenshots has-patch has-testing-info needs-testing
Focuses: ui, administration Cc:


Hey Team,

Today I have just by mistake added space then validation is not working. So I can suggest using the trim function to remove space things too?

Bug Report


Describe the bug.


  • WordPress: 6.5-RC4
  • PHP: 7.4.3-4ubuntu2.20
  • Server: Apache/2.4.41 (Ubuntu)
  • Database: mysqli (Server: 8.0.36-0ubuntu0.20.04.1 / Client: mysqlnd 7.4.3-4ubuntu2.20)
  • Browser: Chrome (Linux)
  • Theme: Twenty Eleven 4.5
  • MU-Plugins: None activated
  • Plugins:
    • Advanced Custom Fields PRO 6.0.7
    • Elementor 3.17.3
    • Favorites Any Post 1.0.0
    • React Post Listing 1.0.0
    • Simple Custom Post Order 2.5.7
    • WooCommerce 8.3.1
    • WooPayments 6.8.0
    • WordPress Beta Tester 3.5.5

Steps to Reproduce

  1. GO to Add New Category
  2. add space on the Category name then click on the "Add New Category" button
  3. 🐞 Bug occurs.

Expected Results

  1. ✅ should be an error even if only added space on the field

Actual Results

  1. ❌ an error even added only space on the field

adding quick recording too.

Attachments (4)

Categories ‹ wp-extended — WordPress.mp4 (864.7 KB) - added by sumitsingh 2 months ago.
Categories-‹-wp-extended-—-WordPress.png (207.8 KB) - added by sumitsingh 2 months ago.
error message i can see but input box is not hilighting when adding space
2024-04-02 17-51-34.mkv (3.3 MB) - added by pratiklondhe 2 months ago.
Tested the patch
vlLu4AMQR2WRJ_jXsXaeCg.png (172.7 KB) - added by pratiklondhe 2 months ago.

Change History (10)

2 months ago

error message i can see but input box is not hilighting when adding space

This ticket was mentioned in PR #6343 on WordPress/wordpress-develop by swapnilghone.

2 months ago

  • Keywords has-patch added

Added trim validation to Add new category name


This ticket was mentioned in Slack in #core-test by ankit-k-gupta. View the logs.

2 months ago

#3 @Ankit K Gupta
2 months ago

  • Keywords has-testing-info needs-testing added

#4 @swissspidy
2 months ago

  • Component changed from Posts, Post Types to Taxonomy
  • Focuses accessibility javascript removed
  • Version trunk deleted

2 months ago

Tested the patch

#5 @pratiklondhe
2 months ago

Test Report

This report validates that the indicated patch addresses the issue.
Patch tested:


  • OS: macOS 14.3.1
  • Web Server: Nginx
  • PHP: 8.1.9
  • WordPress: 6.5-RC4
  • Browser: Chrome (macOS)
  • Theme: Twenty Twenty-Four

Actual Results

  • ✅ Input box now gets highlighted even when adding space

Supplemental Artifacts

#6 @Hitendra Chopda
8 weeks ago

Test report

I have tested the patch below.


  • OS: macOS Sonoma 14.4
  • Web Server: Nginx
  • PHP: 8.3
  • WordPress: 6.6-alpha-20240402.091906
  • Browser: Safari 7.4 (macOS), Chrome Version 123.0.6312.106
  • Theme: Twenty Twenty-Four 1.1


Actual Result:

  • Input box now gets highlighted even when adding space in the name.

Thank you.

Last edited 8 weeks ago by Hitendra Chopda (previous) (diff)
Note: See TracTickets for help on using tickets.