"i am using the_content filter on the category pages like cat=1" I am appending --N in the content. But due the the theme functionality it strip the content after some number of characters therefore in post with the less content i can see the "--N" string but with the large content i cant see "--N" string as the "content" is being stripped. I want to append the '--N' string every time. Is there is any other way to append the content? enter image description here


function rate_post_content($content) {
        global $post;
        return $content."---N"; // here any test can come
    return $content;

add_filter('the_content', 'rate_post_content');
  • Sorry, I don't quite get what you want to achieve. Could you maybe reword your question?
    – tfrommen
    Oct 10, 2013 at 6:33
  • @intekhabkhan Please post the code you are currently using to do what you are doing i.e. to append the "--N" string.
    – its_me
    Oct 10, 2013 at 7:10
  • Done i have added code.I am using this code in plugin Oct 10, 2013 at 7:25
  • Is the Theme actually calling the_content()? It appears that it is calling the_excerpt() in the screenshot. Oct 10, 2013 at 12:01

2 Answers 2


In functions.php:

function myExcerpt($text) {
    $text = str_replace(']]>', ']]>', $text);
    $text = strip_tags($text);
    $excerpt_length = 50; // max number of words
    $words = explode(' ', $text, $excerpt_length + 1);

    array_push($words, '-N');
    $text = implode(' ', $words);
    return $text;

In your loops:

echo myExcerpt ( get_the_content() );

I'd say run your filter in a later priority, say 50 or so:

add_filter( 'the_content', 'rate_post_content', 50 );

Same goes for the excerpt filter. You just need to make sure the excerpt process is done before your filter is applied.

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.