• I thought get_the_excerpt() would basically be a stripped/filtered get_the_content().

    But if I try to swap get_the_excerpt() for get_the_content(), the site crashes. Why doesn’t this work?

    function add_to_content( $content ) {
    		$got_content = strip_tags( get_the_content() );
    		echo "<!-- content: $got_content -->";
    	return $content;
    }
    add_filter( 'the_content', 'add_to_content');
Viewing 1 replies (of 1 total)
  • get_the_excerpt() uses wp_trim_excerpt() which in turn uses the filter ‘the_content’ – so you are basically creating something that calls itself again and again…

Viewing 1 replies (of 1 total)
  • The topic ‘get_the_excerpt() errors where get_the_content() works’ is closed to new replies.