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.
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 );
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.
Add in your functions.php file:
remove_filter('the_content', 'wpautop');
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