Automatically Add a Category to a Custom Post Type

To answer the first question (pre-populate a CPT with a Cat) you could add following function to functions.php .(make backup first svp)

In the code below movies is the Custom Post Type and horror is the Category.
Please change to own preferences.

/**
 * Set a Category on Custom Post Type
 * 
 * Read more: {@link https://developer.wordpress.org/reference/functions/get_post_type/}
 *            {@link https://codex.wordpress.org/Function_Reference/get_category_by_slug}
 *            {@link https://codex.wordpress.org/Function_Reference/wp_set_object_terms}
 *            
 */
add_action( 'save_post', 'wpse261307_set_cat_on_cpt' );
function wpse261307_set_cat_on_cpt( $post_id )
{
    global $wpdb;

    // Check for correct post type
    if ( get_post_type() == 'movies' ) // Set post or custom-post type name here
    {  
        // Find the Category by slug
        $idObj = get_category_by_slug( 'horror' ); // Set your Category here
        // Get the Category ID
        $id = $idObj->term_id;

       // Set now the Category for this CPT
       wp_set_object_terms( $post_id, $id, 'category', true );
    }

}// end function

I would then make a function which hides the meta-box in the back-end for this specific CPT. (so no one can add/change the category, but that is only useful when you use only 1 category pro posting)

Then you will need to make a function which hide this specific CPT to be shown on the main blog page. (by using a query to exclude the category ‘ jobs’ on the main blog page) .

/**
 * Exclude CPT with Cat jobs on Landing page
 *
 * Read more: {@link https://codex.wordpress.org/Function_Reference/get_category_by_slug}
 *            {@link https://codex.wordpress.org/Function_Reference/wp_set_object_terms}
 *            {@link https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Exclude_categories_on_your_main_page}
 *            {@link https://codex.wordpress.org/Function_Reference/is_main_query#Examples}
 */
add_action( 'pre_get_posts', 'wpse261307_exclude_cat_main_blog' );
function wpse261307_exclude_cat_main_blog( $query )
{   
    global $wpdb;

    // Find the Category by slug
    $idObj = get_category_by_slug( 'horror' );
    // Get the Category ID
    $id = $idObj->term_id;

    if ( $query->is_home() && $query->is_main_query() ) {

        $query->set( 'cat', -$id );
    }

} // end function

Hope this helps you on your way.

Note:
• Add this to a home brew plugin or in a myfunctions.php in the wp-content/mu-plugins folder (which you have to create yourself)
• Imho the most solid solution to be sure nothing get lost (meaning out of sight because it still is in your database) when changing to another theme. (changes made directly in a template file are not anymore visible when you change to another theme)
• Btw, the same (adding them into a myfunctions.php file in the wp-content/mu-plugins folder) I would do for creating Custom Post Types.

Ps, to clarify why I am not a fan of using id numbers directly:

  • It happens that a category is deleted for whatever reason and afterwards it seems a mistake and the same category needs to be created again.
  • When a new category is created (even with the same name) it will get another id number and then (when you use the number itself directly in any code) your functions are not working anymore because of the wrong id number.