Tag Info

New answers tagged

1

You need to add your function in the template_redirect hook. You need to first wait for wordpress to finish loading pages before you can add your hook to remove wpautop, otherwise your hook will simply get run over. So your funtion will look like this function pietergoosen_remove_wpautop() { if ( is_page ( 'services' ) ) { remove_filter( 'the_content', ...


0

Here's what I've found based off this question at Stack Overflow You'll have to remove wpautop entirely then add it back in whenever needed, which I agree in the linked comment, is unfortunate: remove_filter('the_content', 'wpautop'); remove_filter('the_excerpt', 'wpautop'); /** Change How The Content Works **/ function no_content_autop($content){ ...


3

I want to suggest you another approach. You can set a meta when you saving a post if its content is less than 140 chars, so then you can simply runs a simple meta query. add_action( 'save_post_post', function( $id, $post ) { if ( $post->post_status !== 'publish' ) return; if ( strlen( $post->post_content <= 140 ) ) { update_post_meta( $id, ...



Top 50 recent answers are included