[wp-trac] [WordPress Trac] #65045: Duplicate 'Comment' entry in trashableTypes array in wp/api.js

WordPress Trac noreply at wordpress.org
Thu Apr 9 06:54:14 UTC 2026


#65045: Duplicate 'Comment' entry in trashableTypes array in wp/api.js
-------------------------------------------------+-------------------------
 Reporter:  baikare.sandeep007                   |      Owner:  (none)
     Type:  defect (bug)                         |     Status:  new
 Priority:  normal                               |  Milestone:  Awaiting
                                                 |  Review
Component:  REST API                             |    Version:  trunk
 Severity:  normal                               |   Keywords:  has-patch
  Focuses:  javascript, rest-api, coding-        |
  standards                                      |
-------------------------------------------------+-------------------------
 While reviewing the file `src/js/_enqueues/wp/api.js`, I noticed that the
 `trashableTypes` array contains a duplicate entry for 'Comment'.

 Current code:
 trashableTypes = [ 'Comment', 'Media', 'Post', 'Page', 'Status',
 'Taxonomy', 'Type' ];

 The presence of duplicate values in this array is unnecessary and may lead
 to redundant checks or confusion during maintenance.

 Proposed fix:
 Remove the duplicate 'Comment' entry to ensure the array contains only
 unique values.

 This change improves code clarity and avoids potential redundancy in logic
 that relies on this array.


 == Steps to reproduce

 1. Navigate to src/js/_enqueues/wp/api.js
 2. Locate the trashableTypes array
 3. Observe duplicate 'Comment' entry

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65045>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list