1

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

1 Answer 1

1

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 )
4
  • how to check for error using wp_error and if this fails is there any way to display the terms description to all users? Jan 19, 2011 at 12:22
  • @ntechi I had linked to documentation. I have no idea about any way without knowing what is broken.
    – Rarst
    Jan 19, 2011 at 12:37
  • after around 1/2 hour now the description is viewed to everyone. Hows this possible? Jan 19, 2011 at 12:50
  • @ntechi likely it was cached and logged in users were getting non-cached version.
    – Rarst
    Jan 19, 2011 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.