While writing in editor, if we want to add paragraph tag automatically in place of double line break. Then in that case we should use “wpautop” function.

So the code becomes like this :

wpautop($post->post_content);