Is there un-wp_autop function?

I just ran into this situation. Here is a function I used to undo wpautop. I might be missing something, but this is a good start: function reverse_wpautop($s) { //remove any new lines already in there $s = str_replace(“\n”, “”, $s); //remove all <p> $s = str_replace(“<p>”, “”, $s); //replace <br /> with \n $s … Read more

How to enable wpautop for XMLRPC content

So, the default xmlrpc get_post function does not have any nice filters for you to use. The solution: roll your own XML-RPC callback! Hook into xmlrpc_methods and add a custom method, in this case called post_autop. The array key will be the method name, and the value the method callback. <?php add_filter( ‘xmlrpc_methods’, ‘wpse44849_xmlrpc_methods’ ); … Read more

Disable wpautop, keep line breaks

Here’s the full solution. First disable wpautop in your functions.php remove_filter( ‘the_content’, ‘wpautop’ ); remove_filter( ‘the_excerpt’, ‘wpautop’ ); Then parse your content/excerpt with nl2br (a standard PHP function). add_filter( ‘the_content’, ‘nl2br’ ); add_filter( ‘the_excerpt’, ‘nl2br’ );

New method to disable wpautop after WP 4.3?

I guess you don’t use it at all, so why don’t you just remove the filter? remove_filter(‘the_content’, ‘wpautop’); remove_filter(‘the_excerpt’, ‘wpautop’); I’ve tested it a few minutes ago (on WP 4.3) and it works. p.s. I just saw that you use the same function. Sorry for that. What version are you using? This disables the wpautop … Read more

remove empty paragraphs from the_content?

WordPress will automatically insert <p> and </p> tags which separate content breaks within a post or page. If, for some reason, you want or need to remove these, you can use either of the following code snippets. To completely disable the wpautop filter, you can use: remove_filter(‘the_content’, ‘wpautop’); If you still want this to function … Read more