How can I set a default category for a custom post type in wordpress?
<p>I am trying to put together some functions in wordpress which will allow me to add a custom post type <em>and</em> associate a default category <em>and</em> post on the posts page. </p>

<p>So far I have been able to create a custom post type, and as far as I can tell I am associating a default category. However, the posts do not show up in the post feed. </p>

<p>Here is the code I have pieced together:</p>

<pre><code>add_action( 'init', 'create_prayer_request' );

function create_prayer_request() {
    register_post_type( 'prayer_request',
        array(
            'labels' =&gt; array(
                'name' =&gt; __( 'Prayer Requests' ),
                'singular_name' =&gt; __( 'Prayer Request' ),
                'add_new' =&gt; __( 'Add New Prayer Request' ),
                'add_new_item' =&gt; __( 'Add New Prayer Request' ),
                'edit' =&gt; __( 'Edit' ),
                'edit_item' =&gt; __( 'Edit Prayer Request' ),
                'new_item' =&gt; __( 'New Prayer Request' ),
                'view' =&gt; __( 'View Prayer Requests' ),
                'view_item' =&gt; __( 'View Prayer Request' ),
                'search_items' =&gt; __( 'Search Prayer Requests' ),
                'not_found' =&gt; __( 'No prayer requests found' ),
                'not_found_in_trash' =&gt; __( 'No prayer requests found in Trash' ),
            ),
            'public' =&gt; true,
        )
    );
}

function save_custom_post ( $post_id, $post = null ) {
    if ( !$post ) $post = get_post($post_id);
    if ( !current_user_can( 'edit_posts', $post-&gt;ID ) ) return;
    if ( 'prayer_request' != $post-&gt;post_type ) return;
    if ( defined( 'DOING_AUTOSAVE' ) &amp;&amp; DOING_AUTOSAVE ) return;

    wp_set_object_terms( $post-&gt;ID, 'prayer-request', 'prayer_request' );
}
add_action( "save_post", "save_custom_post", 10, 2 );
</code></pre>
