Blog

Fix: the_content Filter Is Being Called Multiple Times

If you have the problem, that the the_content filter is being called multiple times, you might use an SEO plugin like Yoast SEO, that uses the_content to generate META tags.

To identify the relevant the_content filter call, you can use in_the_loop(), an example:

add_filter( 'the_content', function ( $content ) {
	if ( ! in_the_loop() ) {
		return $content;
	}

	$content = 'CONTENT ADDITION' . $content;

	return $content;
}, 10 );