How to Disable WordPress Auto Wrap Function ‘wpautp’

Update: the current version of WordPress has rendered these methods ineffective. I’ll update this post once a working solution is discovered.

WordPress has this function called ‘wpautop’ that would add <p> tags as wrapper to <script> tags. Hence, it may be necessary to play .js by disabling wpauto such as:

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

At more flexible solution is to use a WordPress plugin such as “wpautop control” contributed by the Dev named @bigsmoke on WordPress.org

Leave a Reply

Your email address will not be published. Required fields are marked *