terms_description and admin problem
Question
Hey hi, I am using a piece of code, where with help of it I can display the description of the term to my archives page. My idea of doing this is simple, I have MBA website and I have 3 custom-taxonomies with 1000's of terms in each, for-eg:- I have a term mba-in-accounts, so its description will be displayed on the archive page of mba-in-accounts,
But now the main problem is, this description comes well, but it is just displayed to logged in users I want to make it display to all users who visits my website, I am using this code to display
<?php
if ( is_tax( 'location' ) ) {
echo term_description();
}
elseif (is_tax('mba_courses')){
echo term_description();
}
elseif (is_tax('duration')){
echo term_description();
}
?>
How can I make it display to all users, and I am also using allow-html-in-category-descriptions plugin to enable HTML in description box
Solution
There is nothing in term_description()
and deeper (that I see) that checks for user.
You can try this and see if it returns WP_Error
that might make term_description()
return empty string:
get_term_field( 'description', $term, $taxonomy )