I have been working for many days on this. I want to assigned category to author. I have googled, found some tips and plugins but doesn’t work with WordPress 3.1. I just come up with my own idea.
I as admin will create a category for an author than define or put category slug name in their respective profile meta field.
I am using a Custom Post type name ‘networks and taxonomy = blogs
Now I am trying to include only the profile meta field value (I said above) in the wp dropdown categories as default and hide it in my custom posting form.
The cat ID and Name are correct when I echo it but it does not include in the drop list. Can anyone help me?
<?php
global $current_user;
get_currentuserinfo();
$authorcategory = get_the_author_meta('authorcategory', $current_user->ID);
$myterm = get_term_by( 'slug', $authorcategory, 'blogs');
if ( is_term( $authorcategory, 'blogs' && $authorcategory == $myterm ) ) {
$my_cat_id = get_cat_id($authorcategory);
$my_cat_name = get_cat_name($my_cat_id);
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'show_last_update' => 0,
'style' => 'list',
'show_count' => 0,
'hide_empty' => 0,
'include' => $my_cat_name,
'hierarchical' => true,
'title_li' => __( 'Categories' ),
'show_option_none' => __('No categories'),
'number' => NULL,
'taxonomy' => 'blogs'
);
wp_dropdown_categories($args);
}
?>