Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#44388 closed defect (bug) (invalid)

Terms metabox admin autocomplete search don't work with custom taxonomies

Reported by: enricosorcinelli's profile enrico.sorcinelli Owned by:
Milestone: Priority: normal
Severity: major Version: 5.1
Component: REST API Keywords:
Focuses: Cc:

Description

With the [42614] changeset, the ajax tags autocomplete search was replaced with REST API search in the admin metabox.

If I didn't missed something, however, that search don't work anymore with custom taxonomies metaboxes.

The end-point used for the search is always tagsSuggestL10n.restURL value (/wp-json/wp/v2/tags) and the taxonomy query param is added with the value of custom taxonomy name to search in.
On the server side the taxonomy param don't seem to be handled / registerd in collection, so it's ignored at all by returning always search over post_tag builtin taxonomy.

The proposal patch try to solve that problem by using taxonomy query value for get_items().

In fact, this will transform /tags end point (and in general all taxonomies end points) as an open proxy end point for all taxonomies even for those that are been registered without sohw_in_rest.

Vice-versa, by constrainting the search only to REST exposed taxonomies, we could have the incorrect behaviour for term autocompletion in metaboxes if the user dont' register custom taxonomy by setting show_in_rest to a true value.

At the end, there is the Gutenberg approach that allows to associate terms to posts only for REST-exposed custom taxonomies (even if I don't like that too much).

Attachments (1)

44388.patch (2.1 KB) - added by enrico.sorcinelli 6 years ago.

Download all attachments as: .zip

Change History (3)

#1 @enrico.sorcinelli
6 years ago

  • Keywords has-patch added

#2 @danielbachhuber
6 years ago

  • Keywords has-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi @enrico.sorcinelli:

In fact, this will transform /tags end point (and in general all taxonomies end points) as an open proxy end point for all taxonomies even for those that are been registered without sohw_in_rest.

See conversation in https://core.trac.wordpress.org/ticket/39965#comment:5 onward for why this isn't tenable.

I've re-opened #38922 to discuss custom taxonomy support.

Note: See TracTickets for help on using tickets.