I've made a function to hook after the_content. This is only working on certain pages/posts. It's working on the default template but not on my custom one's.

function insertFootNote($content) {
   $content.= "<div>";
   $content.="additional content";
   $content.= "</div>";
   return $content;

add_filter ('the_content', 'insertCpontent');

In my custom page template I haven the following code

<?php if(have_posts()): ?>
<?php get_template_part( 'part', 'addressbook' ); ?>
<?php endif; ?>

in the template('part-addressbook.php) I have the following.

 echo '<div class="category-description"><p>'.get_the_content().'</p></div>';

On this template part the hook is not working although i'm using the_content/get_the_content function

Why does the hook does not work in this case?

  • at least somebody understood the question :-) Jul 8, 2015 at 13:42

2 Answers 2


get_the_content do not apply the_content filter. You have to apply it after receiving contents like following

<?php apply_filters('the_content',get_the_content( $more_link_text, $stripteaser, $more_file )) ?>

It is also detailed at the bottom of codex page


You are already echoing the data. Just use the_content():

echo '<div class="category-description"><p>',the_content(),'</p></div>';

Please note: those are commas not periods. echo will accept multiple parameters separated by commas and you will not see the odd results you get if you try to concatenate. The above is functionally the same as:

echo '<div class="category-description"><p>';
echo '</p></div>';

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.