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 modifying the content using the "the_content" filter. But this filtering is seen in the excerpts also.

Consider the following code,

function modify_content($content = ''){
    return 'HELLO ALL' . $content;
add_filter('the_content', 'modify_content');

This works in the main content perfectly.

Filter content in the main post


if you see in the excerpt, the "HELLO ALL" text is printed, which is unwanted. enter image description here

How to avoid or remove the text in the excerpt ??? which is to be added only to the main content ?? I tried changing the priority but it is no use..

Thank you.

share|improve this question

If there are no manual excerpts added to the Post, Wordpress picks the content itself as excerpt for that Post. You may either put the excerpts for Posts manually or apply_filter('the_excerpt', 'modify_excerpt') and remove the unwanted text from the excerpt. The function code-structure will remain almost the same, with the exception that now you will want to remove the "Hello All" from excerpt.

I hope this helps; let us know if this resolves your issue.



share|improve this answer
thanks for the idea. since I am in plugin development, a solid idea will be very useful. – Aakash Chakravarthy Mar 18 '12 at 7:34

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.