Skip to content

Instantly share code, notes, and snippets.

@martynchamberlin
Last active February 16, 2018 00:09
Show Gist options
  • Save martynchamberlin/6227241 to your computer and use it in GitHub Desktop.
Save martynchamberlin/6227241 to your computer and use it in GitHub Desktop.
How to get_the_content() with formatting
<?php
/**
* Instead of calling get_the_content(), call this function instead, and it'll all be good
*/
function get_the_content_with_formatting()
{
ob_start();
the_content();
$the_content = ob_get_contents();
ob_end_clean();
return $the_content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment