1. Home
  2. ReHub Theme
  3. How to …
  4. How to prevent wrong formatting in shortcode

How to prevent wrong formatting in shortcode

Sometimes, when you add shortcode in post, you will find some incorrect spaces. This is because of wrong WordPress auto formatting. For fixing this problem, just add to function.php code:

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop', 100 );

 

Was this article helpful to you? Yes No

How can we help?