Support » Fixing WordPress » category_description return <p> tag

  • If is use echo category_description() i show the correct category description, but wordpress insert <p> at the start of the string and at the end…

Viewing 6 replies - 1 through 6 (of 6 total)
  • One example:

    <?php
    //display category name/description for use in category template
    if ( is_category() ) {
    $cat = get_query_var('cat');
    $category=get_category($cat);
    echo '<p>Category Title/Name: '. $category->name . '</p>';
    echo '<p>Category Description: '. $category->description . '</p>';
    }
    ?>

    But i’m using category description in meta description, so i’m not interested show the <p> tag 🙁

    echo $category->name;

    or

    $myvalue = $category->name;

    Thanks, but why echo category_description()

    return <p> tag ?

    I’m looking for the same fix.

    I want to edit whatever file generates category_description();

    dannybcastillo

    (@dannybcastillo)

    Add:

    …remove_filter(‘term_description’,’wpautop’); in your theme’s functions.php…

    This is the link back to the support post I found.
    LINK

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘category_description return <p> tag’ is closed to new replies.