the_content
echoes post content. It does not return a string that you can manipulate. You need get_the_content()
Swap those functions and it should work.
the_content
echoes post content. It does not return a string that you can manipulate. You need get_the_content()
Swap those functions and it should work.