Custom post type and display only child categories in "New post" page (1 post)

  1. eleonoraz
    Posted 3 years ago #

    I've created a custom post type called "News".

    My standard categories structure is the following:

    [ Moderator note: Fixed. Please don't post raw HTML here without using the code button. And don't use pre either, it kills the formatting. ]

    <li>- Press Releases</li>
    <li>- Events</li>
    <li>- Smartphones</li>
    <li>- Tables</li>
    <li>- Audio</li>

    I've used the following code to automatically insert every custom post in the category News:

    function add_newscategory_automatically($post_ID) {
    	global $wpdb;
    	if(!wp_is_post_revision($post_ID)) {
    	$newscat = array (8);
    	wp_set_object_terms( $post_ID, $newscat, 'category');
    add_action('publish_news', 'add_newscategory_automatically');

    Now I'd like to modify the category box on the right of the "New post" page, displaying only the "news" child subcategories.

    Anyone can help me?

Topic Closed

This topic has been closed to new replies.

About this Topic