'Removing wpautop (p tags are still present)
I would like to understand how to properly remove wpautop.
My code:
function n_custom_html($atts, $content = null){
/**
* [n-custom-html]<script>alert("hi");</script>[n-custom-html]
*/
remove_filter( 'the_content', 'wpautop' );
$result = strval($content);
add_filter( 'the_content', 'wpautop' );
return $result;
}
Then I try to use it:
[n-custom-html]<script>
jQuery( document ).ready(function() {
console.log( "ready!" );
});
jQuery(document).ready(function($){ // Disable scrolling down when pressing spacebar in Wordpress.
window.onkeydown = function(e) { return !(e.keyCode == 32); };
});
document.body.onkeyup = function(e){ // Pause all countdown timers when spacebar is pressed.
if(e.keyCode == 32){ // Spacebar pressed.
alert("hi");
}
}</script>
[n-custom-html]
It has not helped (see the screenshot). What can I try next?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

