[wp-trac] [WordPress Trac] #50648: Different behavior for default category term with editors

WordPress Trac noreply at wordpress.org
Mon Jul 13 13:42:14 UTC 2020


#50648: Different behavior for default category term with editors
-------------------------------+-----------------------------
 Reporter:  enrico.sorcinelli  |      Owner:  (none)
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Editor             |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 During some tests related to #43517 I found a different behaviors on how
 default `category` term is handled with block/classic/quick/REST API/XML-
 RPC API editors.
 I haven't found similar ticket on trac, so sorry in advance if it's a
 duplicate and you have already experienced a similar thing

 Here are the test I've done with table of results.

 === New post with empty `category` taxonomy

 ||= Editor =||=`category` result =||
 ||Block||`Uncategorized`||
 ||Classic||`Uncategorized`||
 ||Quick||`Uncategorized`||
 ||REST API||`Uncategorized`||
 ||XML-RPC API||`Uncategorized`||

 === Updating post by removing all `category` terms

 ||= Editor =||= `category` result =||= Notes =||
 ||Block||—||||
 ||Classic||`Uncategorized`||||
 ||Quick||`Uncategorized`||||
 ||REST API||—||This can be done by explicitly setting `categories` key to
 an empty string.||
 ||XML-RPC API||`Uncategorized`||This cannot be done through XML-RPC
 interface||

 === Updating a post there doesn't has any `category` terms (and without
 changing that taxonomy)

 ||=Editor=||= `category` result =||
 ||Block||`Uncategorized`||
 ||Classic||`Uncategorized`||
 ||Quick||`Uncategorized`||
 ||REST API||`Uncategorized`||
 ||XML-RPC API||`Uncategorized`||

 This different behaviour seems to be related to block editor that send
 taxonomy fields values only if they have been changed.
 And if you remove all categories, block editor will send explicitly an
 empty array: REST post controller calls `wp_set_object_term()` a second
 time in `handle_terms()` method: so it's the why the empty array will
 remove all terms.
 This isn't currently possible with classic/quick/XML-RPC API editors.

 The problem is with custom taxonomies as well.

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


More information about the wp-trac mailing list