php - Exclude specific categories from category list -
below code category list displayed on page
i want remove categories 'page-seo' , 'page-seo-1'. trying 'exclude=cat_id' has worked preventing actual posts displaying on page, doesn't work list of categories.
can see doing wrong?
cheers.
$taxonomy = 'category'; // term ids assigned post. $post_terms = wp_get_object_terms( $post->id, $taxonomy, array( 'fields' => 'ids' ) ); // separator between links $separator = ', '; if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) { $term_ids = implode( ',' , $post_terms ); $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids . '&exclude=66,67'); $terms = rtrim( trim( str_replace( ' ', $separator, $terms ) ), $separator ); // display post categories echo $terms; }
this looking for, exclude command has worked
wp_list_categories('orderby=name&show_count=1&exclude=66,67,68,69,70,71&title_li=');
Comments
Post a Comment