Support » Requests and Feedback » 2.9 strips img tags from description

  • I use the category description in my theme.

    Since the upgrade to 2.9, image tags are stripped from the description (when using category_description();)

    any suggestions?

    Now, I use the “Category Description Editor” plugin, and when I go to edit the category, I can see the image in the editor. So, it’s being saved in the db, but not being included in the function above.

    is there a new function?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I too am having the same issue with the Rich Text Tags plugin ( Began right after the upgrade to 2.9.

    sshilo, I actually found a fix for this. It’s not most elegant setup, I’m no PHP expert, but it works.

    <?php // Get current category ID on category page
    function getCurrentCatID(){
    	global $wp_query;
    	if(is_category() || is_single()){
    		$cat_ID = get_query_var('cat');
    	return $cat_ID;
    $currentCat = getCurrentCatID();
    // Loop through all categories with the rich text descriptions, and display the category description for the current category
    $explorers = get_categories('hide_empty=0&child_of=13');
    foreach ($explorers as $cat) {
    	if($cat->cat_ID == $currentCat) {
    		if ($cat->category_description != '') {
    			echo '<div class="category-desc-entry clearfix">'.$cat->category_description.'</div>';
    		} else {
    			echo '<div class="category-desc-entry clearfix"><p>No description has been entered for this explorers. <a href="'.wp_login_url().'">Log in</a> and go to <strong>Posts > Categories</strong> to add descriptions.</p></div>';
    } ?>

    I used this to display the category description on a category page. It seems that if you call the category description from a get_categories loop, using ->category_description it will include images. I’m sure there’s a way to take this and rewrite the category_description() function; but I’ll leave that up to a more seasoned programmer.

    I hope this helps.

    I have the same problem. Please someone help. What are we suppose to do to make it work again?

    There are two problems:

    1. If you want to display images in your category descriptions you have to replace category_description() in your theme with:

    $category = get_the_category();
    echo $category[0]->category_description;

    2. If you want to add or update category descriptions with images using 2.9 you have to edit the database manually. It seems the admin interface is stripping images before saving to the database.
    If you can use phpMyAdmin or similar try this SQL to get the relevant posts.
    SELECT * FROM wp_term_taxonomy WHERE taxonomy = 'category';

    Today I hate wordpress.

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

    That was intentional, for several reasons. Mainly for security purposes.

    See these:


    Thank you. That worked for me~

    <?php $category = get_the_category(); ?>
    echo $category[0]->category_description;

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘2.9 strips img tags from description’ is closed to new replies.