• Resolved cfm168

    (@cfm168)


    Hello,

    I created a subcategory in page, checked parent and updated it. But there is no new subcategory menu shown under parent category. I have another subcategory that created earlier is there and working fine.

    Please help how to fix it.

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello cfm168,

    Do you have any posts associated with that particular category? Generally, themes choose not to display empty categories.

    Try to add a post to that category and see what happens.

    Hello cfm168 ,
    Try this ,

    add_action( 'after_setup_theme', 'create_subcategory_inside_parent' );
    function create_subcategory_inside_parent() {
    
     if (!term_exists( $term, $taxonomy ))
     {
      $parent = wp_insert_term(
        'Parent Category', // category name
        'category', // taxonomy
        array(
          'description' => 'Category description',
          'slug' => 'parent-category',
        )
      );
    
      wp_insert_term(
        $term, // sub category name
        'category', // taxonomy
        array(
          'description' => 'Child category description',
          'slug' => 'child-category',
          'parent' => $parent['term_id'],
        )
      );
     }
    }
    Thread Starter cfm168

    (@cfm168)

    Used page. Fixed it in admin by adding/drag the page to. Thank you all.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Subcategory not show up’ is closed to new replies.