Skip to content

Commit 0ab9fff

Browse files
author
Oscar Trollhag
authored
Use get_term instead of get_category for taxonomies
When WP_DEBUG is enabled, get_category throws an error for all other taxonomies.
1 parent 9291996 commit 0ab9fff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wp-rest-api-v2-menus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function wp_api_v2_menus_get_menu_items( $id ) {
146146
$slug = basename( get_permalink($item->object_id) );
147147
$item->slug = $slug;
148148
} else if($item->type == 'taxonomy') {
149-
$cat = get_category($item->object_id);
149+
$cat = get_term($item->object_id);
150150
$item->slug = $cat->slug;
151151
} else if($item->type == 'post_type_archive') {
152152
$post_type_data = get_post_type_object($item->object);

0 commit comments

Comments
 (0)