Get the ID of category page with or without any posts

Make use of get_queried_object_id() in your category page. This will return the ID of the category. This is really useful little function. It will return the the: author ID on an author archive page term ID on a taxonomy, tag and category archive pages post ID on a single post page page ID of a … Read more

Add HTML to Term Description

The only way I can see for getting this to work is running the output through html_entity_decode() and stripslashes() and saving it with esc_attr(): Saving the term: $wpdb->update( $wpdb->term_taxonomy, array( ‘description’ => esc_attr( $_POST[‘_term_desc’] ) ), array( ‘term_id’ => $term_id ) ); Showing the term on the front end: echo apply_filters( ‘the_content’, html_entity_decode( stripslashes( $term->description … Read more

Get all categories post is not in

Ok. So, the first bit of code is more correct but it has issues nonetheless. Piece by piece… $categories = get_the_category( $post_id ); $post_id is not set in the code you posted. I assume that value is set earlier in the page somewhere, else that is your first problem. $nocats = get_terms(‘category’, array(‘exclude’ => $categories) … Read more