Remove p tags from category description

By default Wordpress adds paragraph tags to category descriptions. Find out how to stop this.

By default WordPress adds paragraph tags to category descriptions. Stop this by adding the following to your functions.php file

// Remove p tags from category description
remove_filter('term_description','wpautop');

8 replies on “Remove p tags from category description

  1. Avatar for Abdul hameed Abdul hameed says:

    Using wp_strip_all_tags you can get rid of all html tags including , and etc
    https://developer.wordpress.org/reference/functions/wp_strip_all_tags/

    wp_strip_all_tags(category_description());

  2. Great, works like a charm! Thank you for sharing this insight!

  3. Avatar for dert dert says:

    hi,

    how to remove p tags from category description woocommerce?

    not work “remove_filter(‘term_description’,’wpautop’);”

    thanks

    1. Avatar for daretothink daretothink says:

      Yes it does. Just tested myself once again. You need to add this to your functions.php file. If you are using a custom theme then please check with the theme developer.

  4. Avatar for jodyshop jodyshop says:

    Awesome, Working like a charm 🙂 Thank you

    1. Avatar for daretothink daretothink says:

      Pleased it’s still working 🙂

  5. Avatar for Drew Drew says:

    Awesome. EZPZ.

    Too bad no one will ever know why it comes wrapped by default

  6. Avatar for Nathan Swartz Nathan Swartz says:

    Thanks guys, way to keep it nice and simple. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *