I want to know why get_categories()
is auto ascending. I want to return an array, based on the order in which category IDs are included.
This is my code.
<?php
$args = array(
'include'=> '5,4,7,6',
);
$cats = get_categories($args);
?>
I want to know why get_categories()
is auto ascending. I want to return an array, based on the order in which category IDs are included.
This is my code.
<?php
$args = array(
'include'=> '5,4,7,6',
);
$cats = get_categories($args);
?>
Comments are closed.
I’m not sure why you would use
get_categories()
at all, since you already know the order you’re looking for, as well as the target IDs.Instead, I would use
get_category()
, and generate the$categories
array with a simpleforeach
loop:Here is the WordPress function reference
wordpress function reference
Basically you need to pass arguments array to the get_categories function
EDIT: