diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index d94bb928df..75c36e6068 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -151,8 +151,8 @@ function wp_ajax_ajax_tag_search() { } $results = get_terms( - $taxonomy, array( + 'taxonomy' => $taxonomy, 'name__like' => $s, 'fields' => 'names', 'hide_empty' => false, @@ -1085,11 +1085,11 @@ function wp_ajax_get_tagcloud() { } $tags = get_terms( - $taxonomy, array( - 'number' => 45, - 'orderby' => 'count', - 'order' => 'DESC', + 'taxonomy' => $taxonomy, + 'number' => 45, + 'orderby' => 'count', + 'order' => 'DESC', ) ); diff --git a/wp-admin/includes/class-wp-terms-list-table.php b/wp-admin/includes/class-wp-terms-list-table.php index 99f76fd632..44ad543464 100644 --- a/wp-admin/includes/class-wp-terms-list-table.php +++ b/wp-admin/includes/class-wp-terms-list-table.php @@ -214,6 +214,7 @@ class WP_Terms_List_Table extends WP_List_Table { $args = wp_parse_args( $this->callback_args, array( + 'taxonomy' => $taxonomy, 'page' => 1, 'number' => 20, 'search' => '', @@ -237,7 +238,8 @@ class WP_Terms_List_Table extends WP_List_Table { $args['number'] = 0; $args['offset'] = $args['number']; } - $terms = get_terms( $taxonomy, $args ); + + $terms = get_terms( $args ); if ( empty( $terms ) || ! is_array( $terms ) ) { echo '
' . __( 'No items.' ) . '
'; @@ -774,8 +775,8 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $box ) {taxonomy => link_category
'
)
);
- $taxonomy = 'link_category';
- $args['taxonomy'] = $taxonomy;
+ $args['taxonomy'] = 'link_category';
}
- $categories = get_terms( $taxonomy, $args );
+ $categories = get_terms( $args );
if ( is_wp_error( $categories ) ) {
$categories = array();
@@ -136,10 +133,10 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
$full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir );
}
$categories = get_terms(
- 'category',
array(
- 'get' => 'all',
- 'slug' => $leaf_path,
+ 'taxonomy' => 'category',
+ 'get' => 'all',
+ 'slug' => $leaf_path,
)
);
@@ -279,7 +276,10 @@ function sanitize_category_field( $field, $value, $cat_id, $context ) {
* @return WP_Term[]|int $tags Array of 'post_tag' term objects, or a count thereof.
*/
function get_tags( $args = '' ) {
- $tags = get_terms( 'post_tag', $args );
+ $defaults = array( 'taxonomy' => 'post_tag' );
+ $args = wp_parse_args( $args, $defaults );
+
+ $tags = get_terms( $args );
if ( empty( $tags ) ) {
$return = array();
diff --git a/wp-includes/class-walker-category.php b/wp-includes/class-walker-category.php
index c881e68045..d587dd687f 100644
--- a/wp-includes/class-walker-category.php
+++ b/wp-includes/class-walker-category.php
@@ -200,8 +200,8 @@ class Walker_Category extends Walker {
if ( ! empty( $args['current_category'] ) ) {
// 'current_category' can be an array, so we use `get_terms()`.
$_current_terms = get_terms(
- $category->taxonomy,
array(
+ 'taxonomy' => $category->taxonomy,
'include' => $args['current_category'],
'hide_empty' => false,
)
diff --git a/wp-includes/class-wp-customize-nav-menus.php b/wp-includes/class-wp-customize-nav-menus.php
index 9ff9fb3d66..44c19fd162 100644
--- a/wp-includes/class-wp-customize-nav-menus.php
+++ b/wp-includes/class-wp-customize-nav-menus.php
@@ -210,8 +210,8 @@ final class WP_Customize_Nav_Menus {
}
} elseif ( 'taxonomy' === $type ) {
$terms = get_terms(
- $object,
array(
+ 'taxonomy' => $object,
'child_of' => 0,
'exclude' => '',
'hide_empty' => false,
@@ -365,8 +365,8 @@ final class WP_Customize_Nav_Menus {
// Query taxonomy terms.
$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'names' );
$terms = get_terms(
- $taxonomies,
array(
+ 'taxonomies' => $taxonomies,
'name__like' => $args['s'],
'number' => 20,
'offset' => 20 * ( $args['pagenum'] - 1 ),
diff --git a/wp-includes/class-wp-term-query.php b/wp-includes/class-wp-term-query.php
index 4483c2f1ea..13c0ea3f80 100644
--- a/wp-includes/class-wp-term-query.php
+++ b/wp-includes/class-wp-term-query.php
@@ -428,8 +428,8 @@ class WP_Term_Query {
$excluded_children = array_merge(
$excluded_children,
(array) get_terms(
- reset( $taxonomies ),
array(
+ 'taxonomy' => reset( $taxonomies ),
'child_of' => intval( $extrunk ),
'fields' => 'ids',
'hide_empty' => 0,
diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php
index 72aeef2048..a8fad5fdbf 100644
--- a/wp-includes/class-wp-xmlrpc-server.php
+++ b/wp-includes/class-wp-xmlrpc-server.php
@@ -1557,8 +1557,8 @@ class wp_xmlrpc_server extends IXR_Server {
$ambiguous_terms = array();
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
$tax_term_names = get_terms(
- $taxonomy,
array(
+ 'taxonomy' => $taxonomy,
'fields' => 'names',
'hide_empty' => false,
)
@@ -2390,7 +2390,7 @@ class wp_xmlrpc_server extends IXR_Server {
return new IXR_Error( 401, __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ) );
}
- $query = array();
+ $query = array( 'taxonomy' => $taxonomy->name );
if ( isset( $filter['number'] ) ) {
$query['number'] = absint( $filter['number'] );
@@ -2418,7 +2418,7 @@ class wp_xmlrpc_server extends IXR_Server {
$query['search'] = $filter['search'];
}
- $terms = get_terms( $taxonomy->name, $query );
+ $terms = get_terms( $query );
if ( is_wp_error( $terms ) ) {
return new IXR_Error( 500, $terms->get_error_message() );
diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php
index 43295d90af..dcf63bdcfc 100644
--- a/wp-includes/deprecated.php
+++ b/wp-includes/deprecated.php
@@ -1287,7 +1287,13 @@ function get_all_category_ids() {
_deprecated_function( __FUNCTION__, '4.0.0', 'get_terms()' );
if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
- $cat_ids = get_terms( 'category', array('fields' => 'ids', 'get' => 'all') );
+ $cat_ids = get_terms(
+ array(
+ 'taxonomy' => 'category',
+ 'fields' => 'ids',
+ 'get' => 'all',
+ )
+ );
wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
}
diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php
index 68a9e09c3c..98584eac8a 100644
--- a/wp-includes/nav-menu.php
+++ b/wp-includes/nav-menu.php
@@ -597,6 +597,7 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
*/
function wp_get_nav_menus( $args = array() ) {
$defaults = array(
+ 'taxonomy' => 'nav_menu',
'hide_empty' => false,
'orderby' => 'name',
);
@@ -612,7 +613,7 @@ function wp_get_nav_menus( $args = array() ) {
* @param array $menus An array of menu objects.
* @param array $args An array of arguments used to retrieve menu objects.
*/
- return apply_filters( 'wp_get_nav_menus', get_terms( 'nav_menu', $args ), $args );
+ return apply_filters( 'wp_get_nav_menus', get_terms( $args ), $args );
}
/**
@@ -727,8 +728,8 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
if ( ! empty( $terms ) ) {
foreach ( array_keys( $terms ) as $taxonomy ) {
get_terms(
- $taxonomy,
array(
+ 'taxonomy' => $taxonomy,
'include' => $terms[ $taxonomy ],
'hierarchical' => false,
)
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index ab9f63753d..881afcd41f 100644
--- a/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
+++ b/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
@@ -184,7 +184,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
'slug' => 'slug',
);
- $prepared_args = array();
+ $prepared_args = array( 'taxonomy' => $this->taxonomy );
/*
* For each known parameter which is both registered and present in the request,
@@ -249,7 +249,7 @@ class WP_REST_Terms_Controller extends WP_REST_Controller {
// Used when calling wp_count_terms() below.
$prepared_args['object_ids'] = $prepared_args['post'];
} else {
- $query_result = get_terms( $this->taxonomy, $prepared_args );
+ $query_result = get_terms( $prepared_args );
}
$count_args = $prepared_args;
diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
index e6c4332fbb..5895588e38 100644
--- a/wp-includes/taxonomy.php
+++ b/wp-includes/taxonomy.php
@@ -1131,7 +1131,7 @@ function get_term_to_edit( $id, $taxonomy ) {
* @param array $deprecated Argument array, when using the legacy function parameter format. If present, this
* parameter will be interpreted as `$args`, and the first function parameter will
* be parsed as a taxonomy or array of taxonomies.
- * @return array|int|WP_Error List of WP_Term instances and their children. Will return WP_Error, if any of $taxonomies
+ * @return array|int|WP_Error List of WP_Term instances and their children. Will return WP_Error, if any of taxonomies
* do not exist.
*/
function get_terms( $args = array(), $deprecated = '' ) {
@@ -1685,7 +1685,10 @@ function sanitize_term_field( $field, $value, $term_id, $taxonomy, $context ) {
* @return array|int|WP_Error Number of terms in that taxonomy or WP_Error if the taxonomy does not exist.
*/
function wp_count_terms( $taxonomy, $args = array() ) {
- $defaults = array( 'hide_empty' => false );
+ $defaults = array(
+ 'taxonomy' => $taxonomy,
+ 'hide_empty' => false,
+ );
$args = wp_parse_args( $args, $defaults );
// backward compatibility
@@ -1696,7 +1699,7 @@ function wp_count_terms( $taxonomy, $args = array() ) {
$args['fields'] = 'count';
- return get_terms( $taxonomy, $args );
+ return get_terms( $args );
}
/**
@@ -2191,8 +2194,8 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
* unless a unique slug has been explicitly provided.
*/
$name_matches = get_terms(
- $taxonomy,
array(
+ 'taxonomy' => $taxonomy,
'name' => $name,
'hide_empty' => false,
'parent' => $args['parent'],
@@ -2219,8 +2222,8 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
if ( ! $slug_provided || $name_match->slug === $slug || $slug_match ) {
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
$siblings = get_terms(
- $taxonomy,
array(
+ 'taxonomy' => $taxonomy,
'get' => 'all',
'parent' => $parent,
'update_term_meta_cache' => false,
@@ -3470,8 +3473,8 @@ function _get_term_hierarchy( $taxonomy ) {
}
$children = array();
$terms = get_terms(
- $taxonomy,
array(
+ 'taxonomy' => $taxonomy,
'get' => 'all',
'orderby' => 'id',
'fields' => 'id=>parent',
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7bba65b2dc..2bf3164ae7 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
-$wp_version = '5.3-alpha-45722';
+$wp_version = '5.3-alpha-45723';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-includes/widgets/class-wp-widget-links.php b/wp-includes/widgets/class-wp-widget-links.php
index 2f764424c2..233c64bcd8 100644
--- a/wp-includes/widgets/class-wp-widget-links.php
+++ b/wp-includes/widgets/class-wp-widget-links.php
@@ -137,7 +137,7 @@ class WP_Widget_Links extends WP_Widget {
'limit' => -1,
)
);
- $link_cats = get_terms( 'link_category' );
+ $link_cats = get_terms( array( 'taxonomy' => 'link_category' ) );
$limit = intval( $instance['limit'] );
if ( ! $limit ) {
$limit = -1;