I am developing site with WordPress and I'm newbie for WordPress. WP adds <p>
tag in editor while adding any post or pages. But I can't see the <p>
tag in HTML mode.
Can anyone suggest me what might be the problem?
Thanks in advance
Try adding the following line just before the_content() tag in your template:
<?php remove_filter ('the_content', 'wpautop'); ?>
Source
It's not difficult to do this. To display the p and br tag we just need to install plugin which is "tinymce-advanced" and do some setting change. To change the setting just click check box for "Stop removing the p and br tags when saving and show them in HTML editor
" and save. Now we can see the p and br tags in HTML mode.
:)
When you retrieve the stored data from the database, you need to run a filter on it to add the p and br tags back in. This is how wordpress handles content. When you use the_content(), for example, it is already running a filter on it, so when you have a custom loop, you may need to run the filter manually.
<?php echo apply_filters('the_content', $your_retrieved_data); ?>
reference: http://codex.wordpress.org/Function_Reference/apply_filters
You definitely don't need a plugin, and I would recommend not using the method described by user75472. Your data won't be as clean and future-proof.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With