Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the_content() without <p> before - WordPress

Tags:

wordpress

I'm running 'the loop' on my index page, and when I put the_content() on the loop its automatically adding '<p>..</p>' between the content and I want to cancel it.

any ways? Thank you.

like image 942
Luis Avatar asked Apr 02 '11 09:04

Luis


People also ask

How do I remove the P tag from content in Wordpress?

Here is the code that we use: // Prevent WP from adding <p> tags on pages function disable_wp_auto_p( $content ) { if ( is_singular( 'page' ) ) { remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); } return $content; } add_filter( 'the_content', 'disable_wp_auto_p', 0 );

What is The_content?

By design, the_content() tag includes a parameter for formatting the <! --more--> content and look, which creates a link to “continue reading” the full post.


1 Answers

Add in your functions.php file:

remove_filter('the_content', 'wpautop');
like image 189
Prydie Avatar answered Oct 04 '22 05:10

Prydie