$categories = get_categories(array(
'orderby' => 'count',
'order' => 'DESC',
'hide_empty' => true
));
$counts = wp_list_pluck($categories, 'count');
$max_count = max($counts);
$min_count = min($counts);
$count_range = ($max_count - $min_count) ? ($max_count - $min_count) : 1;
$normalized = ($category->count - $min_count) / $count_range;
$font_size = 14 + round($normalized * 10, 2);
fetch( url, {
method: 'POST',
headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache'
}),
credentials: 'same-origin',
body: new URLSearchParams({
action: 'ty_questgo',
}),
}).then(response => response.json())
.then(response => console.log(response))
.catch(err => console.log(err));