Automatically assign a category to a certain post format
Currently we are developing a new social blogging theme. What we need is to automatically assign a category to a certain post format. For example,we want all posts under ‘Image’ to be assigned with the category ‘pictures’.
Here is the code we will be using:
[php]
/**
* automatically set image category to image format posts
**/
add_action( ‘save_post’, ‘ultra_set_post_category_image’ );
function ultra_set_post_category_image( $postID ) {
if ( !has_post_format( ‘image’, $postID ) || has_term( ‘pictures’, ‘category’, $postID ) )
return;
wp_set_object_terms( $postID, ‘pictures’,’category’ );
}
[/php]
Also we are trying to do reversely, that is to make all posts under category ‘pictures’ assigned to post format ‘image’. We don’t find the solution yet.