How I can get sub category in WordPress in a short-code

I would like to show subcategory list in a short code.
I like if shortcode will be like [football_subcategory]

I want all list all sub category in a list

>Solution :

You can get it like this:

add_shortcode('football_subcategory', 'football_subcategory');
function football_subcategory(){
    $taxonomies = array( 

$args = array(
    'parent'         =>1625, //put your parent category ID
    'hide_empty' => false, // you can make it true and false
    // 'child_of'      => $parent_term_id, 

$terms = get_terms($taxonomies, $args);
//add a loop and get all details about category
    echo '<pre>';

Leave a Reply