WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

All my teaser excerpts have no formatting applied to them. With firebug I can get the text to look how I want by editing the html but I don't know where to edit the html in wordpress. How can I do this? Thanks

share|improve this question

wordPress does this by default. you can either use a plugin such as: http://wordpress.org/extend/plugins/advanced-excerpt/ http://wordpress.org/extend/plugins/the-excerpt-re-reloaded/

or write your own functions to remove the default filters from the_excerpt() such as: http://bacsoftwareconsulting.com/blog/index.php/wordpress-cat/how-to-preserve-html-tags-in-wordpress-excerpt-without-a-plugin/

share|improve this answer
caveat: this code bacsoftwareconsulting.com/blog/index.php/wordpress-cat/… does seem to leave broken html tags - tested with a <strong> tag. – Michael Feb 25 '12 at 20:11
Thanks for the suggestions but I probably should have mentioned that I'm using the thesis theme therefore the plugin doesn't do the job. I found this code in the link you provided: $allowed_tags = '<p>,<a>,<em>,<strong>,<img>'; which sounds promising but I'm not sure how to implement it – Nick Feb 25 '12 at 20:23
plugins don't work w/ thesis? i'm skeptical. – helgatheviking Feb 25 '12 at 23:45

@Michael: I wrote the tutorial you are referring to: http://bacsoftwareconsulting.com/blog/index.php/wordpress-cat/how-to-preserve-html-tags-in-wordpress-excerpt-without-a-plugin/

It does not leave any broken html tags, I use it on my blog. Unless the excerpt ends between the starting and ending tag. You need to make sure that your excerpt does not break whatever tag you are using. Check it out in the main page: http://bacsoftwareconsulting.com/blog/

@Nick: To answer the question on how to use the code of the reference above: Copy the "MAIN_CODE" and paste it in your "functions.php" file of the thesis theme. After that you need to replace line 22 of the "MAIN-CODE" with the "$allowed_tags" you want. For instance to allow p, a, em, strong and image, you replace Line 22: with $allowed_tags = '<p>,<a>,<em>,<strong>,<img>';

One of the things the code can't do is to add color or larger fonts. Like I said before, you always need to make sure that the excerpt does not end in between the opening and closing tags. You can also change lines 25 and 28 to your liking. The tutorial is self explanatory, but you need to spend on it few extra minutes.

Hope this Helps.


share|improve this answer
my apology if my remark caused any offence, however I am of the opinion that it should not be the user's task to make sure that the excerpt is not cutting through any html tag. that is the whole point of an automatic excerpt, and any coding to keep html tags in the excerpt should take care of this. I also looked this up myself in the past, and I am aware that this is no simple task. I have not checked if the 'advanced-excerpt' plugin can do this. – Michael Feb 25 '12 at 23:40
i think there is a specific file/folder in thesis for custom functions (ie that won't get overwritten on upgrades), but since i don't use it i am not 100% certain. point being, for the OP to be careful posting things in functions.php w/ a theme like Thesis that will probably see updates – helgatheviking Feb 25 '12 at 23:46
Thanks a lot, it worked. – Nick Feb 26 '12 at 1:47
I agree, for the thesis theme, you should refer to the documentation where to add user generated functions. It might be in a different place than "functions.php". – Boutros AbiChedid Feb 26 '12 at 20:06

Use remove_all_filters to remove filters on the_excerpt. Have a look at wp-includes/default-filters.php - a ton of filters are added to the_excerpt and get_the_excerpt which removes most of the formatting.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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