Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using an automation solution to pull my videos into a category. It seems the automation solution cannot account for custom post types and custom post type categories, so I'm having to send all of my video content to a normal category. How can I still take advantage of my theme's custom post types?

Is there a way I could do some hard wiring? Or is there a plugin that will help me connect the two?

Edit

This is as far as I was able to get with automating the solution programatically (but you can see, this depends on the taxonomy name of the custom-post-type-category being standardized as 'taxonomy_uniquename'):

//insert rss item into database store   
$post = array(      
    'post_author' => $campaign_author[$key],
    'post_category' => $cat, 
    'post_content' => $description, 
    'post_date' => $date_placeholder,
    'post_date_gmt' => $gmt_date,
    'post_name' => $permalink_name,
    'post_status' => $post_status, 
    'post_title' => $title,
    'post_type' => $campaign_post_type[$key],
    'tags_input' => "$tags",
    'original_source'=> $link
);  
$post_id = wp_insert_post( $post, $wp_error );

//echo $wp_error; exit;
if ($campaign_post_type[$key]!='post'||$campaign_post_type[$key]!='page') {
    wp_set_object_terms($post_id,intval($cat[0]),"taxonomy_$campaign_post_type[$key]");
}
share|improve this question
    
Without code there's not much to think around. How does the automation solution work? What functions does it use to do what it does? –  soulseekah Oct 18 '11 at 5:38
add comment

1 Answer

If you need to register the built in category taxonomy for a custom post type you can do this by using the priority argument when adding an init action hook.

add_action( 'init', 'add_category_to_post_types', 11 );
function add_category_to_post_types() {
   register_taxonomy_for_object_type( 'category', 'my_post_type' );
}

The third argument in the add_action() call sets a priority so most things in wordpress will occur at the default priority of 10. By setting this to 11 your custom post type should be registered and the built in taxonomies will definitely be registered so you can add to your post type.

If that doesn't work you need to check the priority of the action hook in which your post type is registered and set the number 11 above to something higher than that.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.