您可以使用get_terms_orderby
过滤器:
add_filter( \'get_terms_orderby\', \'wpse156153_get_terms_orderby\', 10, 3 );
$categories=get_categories($cat_args);
remove_filter( \'get_terms_orderby\', \'wpse156153_get_terms_orderby\', 10, 3 );
使用
function wpse156153_get_terms_orderby($orderby, $args, $taxonomies ) {
return \'FIELD(t.term_id, \' . $args[\'include\'] . \')\';
}