[wp-trac] [WordPress Trac] #40954: Create Category within posts screen error

WordPress Trac noreply at wordpress.org
Sun Apr 7 21:26:17 UTC 2024


#40954: Create Category within posts screen error
-------------------------------+-------------------------
 Reporter:  cfastenrath        |       Owner:  (none)
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  4.8
 Severity:  normal             |  Resolution:  invalid
 Keywords:  close              |     Focuses:  javascript
-------------------------------+-------------------------

Comment (by boceksumuklu):

 To fix the JavaScript error related to handling the AJAX response when
 creating a new category within the "create posts" screen in WordPress, we
 need to ensure that the code properly handles cases where the object may
 be undefined or null before accessing its properties. Here's a suggested
 fix:

 {{{#!php
 Object.c = function( a, b ) {
     if (a && b && a.constructor === b.constructor) {
         a.length && (a.length = 0);
         for (var c = 0; c < b.length; c++) {
             a[c] = b[c];
         }
         a.length = b.length;
     } else {
         a = b && 'number' == typeof b.length ?
 Array.prototype.slice.call(b) : b;
     }
     return a;
 };

 }}}

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


More information about the wp-trac mailing list