Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#45297 closed defect (bug) (fixed)

_wp_ajax_menu_quick_search: Deprecated taxonomy input for get_terms

Reported by: birgire's profile birgire Owned by: pento's profile pento
Milestone: 5.1 Priority: normal
Severity: normal Version: 4.5
Component: Taxonomy Keywords: has-patch
Focuses: administration Cc:

Description

In _wp_ajax_menu_quick_search() the taxonomy input is deprecated since 4.5.

The taxonomy input for get_terms() should now be part of the argument array.

See e.g.

https://developer.wordpress.org/reference/functions/get_terms/

So we need to change:

$terms = get_terms( $matches[2], array(
    'name__like' => $query,
    'number' => 10,
));

in https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-admin/includes/nav-menu.php#L109

to

$terms = get_terms(
    array(
        'taxonomy'   => $matches[2],
        'name__like' => $query,
        'number'     => 10,
    )
);

Attachments (1)

45297.diff (678 bytes) - added by birgire 5 years ago.

Download all attachments as: .zip

Change History (4)

@birgire
5 years ago

#1 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 5.1
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#2 @pento
5 years ago

  • Owner changed from SergeyBiryukov to pento
  • Status changed from reviewing to accepted

#3 @pento
5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 44686:

Menus: Fix a deprecated call to get_terms().

The taxonomy should be passed as part of $args, rather than as its own argument.

Props birgire.
Fixes #45297.

Note: See TracTickets for help on using tickets.