You seem to be mixing up wp_list_categories
arguments with wp_dropdown_categories
, so i’ve removed them from the code that follows, i’ve also assumed the include argument is suppose to refer to the currently selected item.
For ref:
Suggested code:
global $current_user;
get_currentuserinfo();
$authorcategory = get_user_meta( $current_user->ID, 'authorcategory', true );
$user_term = get_term_by( 'slug', $authorcategory, 'blogs');
// Uncomment the two forward slashes before print for debug
// print '<pre>';print_r( $authorcategory );print '</pre>';
if( $user_term ) {
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'show_last_update' => 0,
'show_count' => 0,
'hide_empty' => 0,
'selected' => 0,
'child_of' => $user_term->ID,
'hierarchical' => true,
'title_li' => __( 'Categories' ),
'show_option_none' => __('No categories'),
'taxonomy' => 'blogs'
);
wp_dropdown_categories($args);
}
You didn’t need either of these two lines..
$my_cat_id = get_cat_id($authorcategory);
$my_cat_name = get_cat_name($my_cat_id);
You already have a complete object of that term in $myterm
after you call get_term_by
.
Hope that helps..