To get only the children of a specific category ID (in this case, 12), you can modify the $cat_args array as follows:

$cat_args = array(
   'meta_key' => 'qq_cat_piority',
   'orderby' => 'meta_value_num',
   'order' => 'ASC',
   'hide_empty' => false,
   'child_of' => 12 // Add this line to specify the parent category ID
);

$qqcpategories = get_terms( 'qqcpat', $cat_args );

By adding the 'child_of' parameter with the desired category ID, the get_terms() function will only retrieve the children categories of that specific parent category

$cat_args = array meta_key = qq_cat_piority orderby = meta_value_num order = ASC hide_empty = false; $qqcpategories = get_terms qqcpat $cat_args ;i want this query only children of 12 catego

原文地址: https://www.cveoy.top/t/topic/iBdb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录