0

I am trying to add the excerpt from a specific post to the content.

function add_2_the_content( $content ) {
  if (is_front_page()){
      $custom_content = get_the_excerpt('some_id_number');
  }
  $custom_content .= $content;
return $custom_content;
}

add_filter( 'the_content', 'add_2_the_content' );

But when I do this I get an error.

Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting!

I have searched for this error but have not found an answer that would explain why it is not working with get_the_excerpt.

2
  • Where and how are you using add_2_the_content()? – Jacob Peattie Mar 5 at 5:06
  • It is placed in my functions.php, it is the minimized code to extract the error. The end goal will be to show multiple excerpt from different posts on the front page. – Leadhood Mar 5 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.