• and after it to echo them to select box as options
    where the value of all option [ who will had child category indise ] will be the child category id
    I will make the options with foreach

    thanks ??

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    So you need an array of child terms to loop through. Like how we get any set of terms, we use WP_Term_Query class, or its wrapper function get_terms(). For categories you could use get_categories(), which then calls get_terms() internally. You’ll need the term ID of the current category. How to get that depends on the context.

    Once you have the current term ID, you can either get only immediate children (no grand children, etc.) or all descendants. Use either the “parent” or “child_of” argument.
    https://developer.www.ads-software.com/reference/classes/wp_term_query/__construct/

Viewing 1 replies (of 1 total)
  • The topic ‘how to get current category childs array [ by cat id ]’ is closed to new replies.