refactor: remove forum and topic feature chains
This commit is contained in:
@@ -258,7 +258,7 @@ class GlobalController extends ControllerBase {
|
||||
if ($term_id > 0) {
|
||||
$term = get_term($term_id);
|
||||
$taxonomy = ($term && !is_wp_error($term)) ? (string) $term->taxonomy : 'category';
|
||||
if (!in_array($taxonomy, ['category', 'topics'], true)) {
|
||||
if ($taxonomy !== 'category') {
|
||||
$taxonomy = 'category';
|
||||
}
|
||||
$args['tax_query'] = [[
|
||||
@@ -350,28 +350,6 @@ class GlobalController extends ControllerBase {
|
||||
];
|
||||
}
|
||||
|
||||
if (taxonomy_exists('topics')) {
|
||||
$topics = get_terms([
|
||||
'taxonomy' => 'topics',
|
||||
'hide_empty' => false,
|
||||
'orderby' => 'name',
|
||||
'order' => 'ASC',
|
||||
]);
|
||||
if (!is_wp_error($topics)) {
|
||||
foreach ($topics as $term) {
|
||||
$data[] = [
|
||||
'id' => (int) $term->term_id,
|
||||
'term_id' => (int) $term->term_id,
|
||||
'name' => $term->name,
|
||||
'slug' => $term->slug,
|
||||
'count' => (int) $term->count,
|
||||
'parent' => (int) $term->parent,
|
||||
'taxonomy' => 'topics',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->success(['data' => $data]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user