Hook added to the_content seems to be called multiple times

It is normal for content to be accessed multiple times. For example SEO plugins need to do this to access it and generate meta data from.

Also it is a filter hook. Filters should never echo anything to the page, they are meant to modify passed value and return it.

If you do want to do something at that point, but only within the loop then in_the_loop() is condition you need.

Leave a Comment