{"id":3077477,"date":"2012-09-28T06:39:34","date_gmt":"2012-09-28T06:39:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/get-a-post-content-with-proper-html-tags\/"},"modified":"2016-08-20T16:00:02","modified_gmt":"2016-08-20T16:00:02","slug":"get-a-post-content-with-proper-html-tags","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/get-a-post-content-with-proper-html-tags\/","title":{"rendered":"Get a post content with proper html tags"},"content":{"rendered":"<p>Hallo,<br \/>\ni&#8217;m taking a post in this way inside an ajax request:<\/p>\n<pre><code>$object_single_post = get_post($post_id);\n$content = $object_single_post-&gt;post_content;<\/code><\/pre>\n<p>after this task the content of the $content variable is the post with no paragraphs, example:<\/p>\n<p>EX.1<\/p>\n<pre><code>\\r\\nFirst paragraph\\r\\n\\r\\nSecond paragraph<\/code><\/pre>\n<p>This post content when displayed in a post automatically becomes:<\/p>\n<p>EX.2<\/p>\n<pre><code>&lt;p&gt;First paragraph&lt;\/p&gt;\n&lt;p&gt;Second paragraph&lt;\/p&gt;<\/code><\/pre>\n<p>I&#8217;m trying to understand which wordpress function convert the content of the database ( EX.1 ) to the final post ( EX.2 )<br \/>\nI can convert \\r\\n to <code>&lt;br \/&gt;<\/code>  but i don&#8217;t like very much this solution and i want the same conversion that wordpress does.<\/p>\n","protected":false},"template":"","class_list":["post-3077477","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3077477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/3077477\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=3077477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}