Is there an Action/a Filter that runs just after each post/post excerpt is displayed on these 2 pages? I use the_content and get_the_excerpt currently, but the_content causes a conflict with some other plugin (hence executing my function twice so the content is displayed twice) and setting the priority isn't working!

Note: I've tried the_post, but it runs before each post in the loop on these 2 pages.


My plugin adds a custom markup with icons after the post content using: the_content- for single post/page and as some themes use the_content('Read More') on index/archive pages

get_the_excerpt - for index/archive pages

The plugin Advanced Excerpt adds some options for post excerpts, and allows the user to set the excerpt length from the settings. When the post length is less than the set excerpt length (via AEs settings), my markup is doubled! When I comment out the_content from my code, the conflict goes off, but without the_content how would I make my plugin work on single page/posts and also with some themes which use the_content('Read More') on index/archive pages? I guess it happens because AE calls the_content instead of the_excerpt when the post length is less than the set excerpt length, hence resulting in a double call. I tried setting the priority of my filter function high, so that it runs after AE's filter function, but no luck! Hence trying a workaround! I hope this clears the question!

  • Please explain the problem you're having with the function being called twice, i'd suggest working to fix that issue instead of working around it(sounds like a plugin or custom code is hooking a filter wrongly).
    – t31os
    Dec 19, 2011 at 16:11
  • Edited question... Dec 19, 2011 at 17:25
  • I think you should be working with the_content filter instead of the action. Jul 15, 2012 at 17:57
  • Did my answer work for you?
    – fuxia
    Jul 29, 2012 at 20:11
  • Thanks man! Actually the filter seemed right, the issue was with the quotes and double quotes order, I was putting the html string in double quotes and the attributes in single, when it should be the other way round, fixed it, and the problem disappeared! Accepting your answer! ;) Jul 30, 2012 at 5:06

1 Answer 1


I am not aware of a dedicated action, but you could prevent double processing with an internal cache in your function.

Pseudo code:

function content_filter( $content )
    static $cache = array();
    $id           = get_the_ID();

    if ( in_array( $id, $cache ) )
        return $content; // we did this already

    $cache[] = $id;

    return $content . 'your awesome extra';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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