How make to not add article in parent category in wordpress

How transform parent category in title. I want to add article only in subcategory, and categories appear only as decoration.

Ex:

Read More

Category(5) //You can not add articles
Subcategory1(3) //You can add article
Subcategory2(2) //You can add article
Subcategory3(0) //You can add article

Category(2) //You can not add articles
Subcategory1(1)
Subcategory2(1)

I have this code:

$cat = $_POST['cat'];

$date = array(
'post_title' => $tite,
'post_content' => $des,
'post_status' => 'publish',
'post_category' =>array($cat),
'post_author' => $user_ID,
);

wp_insert_post($date);

and

<?php wp_dropdown_categories('orderby=name&hide_empty=0&show_count=1&show_option_none=All Category&class=categorie&hierarchical=1&name=cat'); ?>

Related posts

Leave a Reply