1

Is there a way I can stop Wordpress auto formatting everything I enter inside a shortcode tag?

A the moment I want to include a h2, a paragraph and another shortcode, but everytime I do Wordpress wraps each different elemnt in p tags.

Is there a way to remove this so I can format each part individually?

2
2

You can postpone the wp_autop filter which is responsible for wrapping elements in P tags till after shortcodes are rendered:

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 12);
1
  • This almost worked perfectly apart from the fact it added empty paragraphs between each shortcode. I just used p:empty{display:none} and it looks great now. Thanks a lot – Dean Elliott Mar 21 '12 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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