Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

the_content is always surrounded by paragraphs, it doesn't matter if I'm in HTML view and there's nothing there. Does WordPress have a function to remove them? IS there any way?

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

Removing the filter that adds the P is the best option.

remove_filter('the_content','wpautop');
remove_filter('the_content','shortcode_autounp'); // You may want to do this aswell
share|improve this answer
    
+1 wpautop is really irritating. It breaks things left and right. –  Peter Rowell Jan 26 '11 at 5:00
    
It's never broken anything for me, i always find it odd that people have such big usses with the editor(i switch modes alot and my code/content is always maintained). –  t31os Jan 26 '11 at 14:26
    
I've had the autounp break, but if you disable wpautop you can think it's that which is broken. Weird thing is it's an intermittent regex error. –  Backie Jan 26 '11 at 14:32
add comment

You can implement your own function in your theme's function.php file and use it instead of "the_content"

function my_content($post){
    $content = apply_filters('the_content', $post->post_content); // added to parse shortcodes
    $content = str_replace(']]>', ']]&gt', $content); // added to parse shortcodes
    echo content;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.