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

I am currently using a wordpress plugin called "limit-posts" to better customize my post excerpts. The only issue I have is the excerpt is including the caption text from the image that is within the post.

I can see in the code that all captions are enclosed in tags

Is there a way I can strip out the any content within em tags from the post excerpt?

Here is a link to the current plugin in use - http://labitacora.net/comunBlog/limit-post.phps

Thank you very much

share|improve this question

From what I understand the caption is a shortcode, so wrap get_the_content(...) inside strip_shortcodes() and it should remove it...

share|improve this answer
Thanks, it works fine for me..:) – Sangram Anand Feb 21 '13 at 11:25

I'd not use something like this at all. There are plenty of hooks for content and excerpt retrieval to use, I see absolutely no need to drop native functions in favor of something else.

You can use excerpt_length filter to change excerpt length (in words) or the_excerpt to make changes to excerpt's text before output.

If I may ask - what is your technical level with WordPress? Do you want some code examples for this? If so please write out how exactly you want excerpt modified.

share|improve this answer

You can always simply hide it with CSS.
It's not a perfect solution but may be sufficient for your case.

CSS class of the caption paragraph is .wp-caption-text

share|improve this answer

Your Answer


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