ob_start();
the_content();
$content = ob_get_clean();

fonte: www.sastgroup.com