• Resolved Insect Trojan

    (@insecttrojan)


    add_filter(‘the_content’, ‘remove_empty_p’, 20, 1);
    function remove_empty_p($content){
    if ( ! is_page( ‘ekpaideush’ ) ) {
    $content = force_balance_tags($content);
    }
    return preg_replace(‘#<p>\s*+(<br\s*/*>)?\s*</p>#i’, ”, $content);
    }

    hello is the code right ? can it exlude now the code from ekpaideush ? thanks a lot

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    If you would like to completely prevent this code from running on the page with the slug ekpaideush, you should use this code:

    add_filter( 'the_content', function ( $content ) {
    	
    	if ( is_page( 'ekpaideush' ) ) {
    		return $content;
    	}
    	
    	$content = force_balance_tags( $content );
    	return preg_replace( '#<p>\s*+(<br\s*/*>)?\s*</p>#i', '', $content );
    }, 20 );
    Thread Starter Insect Trojan

    (@insecttrojan)

    thanks a lot for the code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘exclude code from a single page’ is closed to new replies.