Title: exclude code from a single page
Last modified: July 30, 2021

---

# exclude code from a single page

 *  Resolved [Insect Trojan](https://wordpress.org/support/users/insecttrojan/)
 * (@insecttrojan)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/exclude-code-from-a-single-page/)
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fexclude-code-from-a-single-page%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/exclude-code-from-a-single-page/#post-14744500)
 * 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](https://wordpress.org/support/users/insecttrojan/)
 * (@insecttrojan)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/exclude-code-from-a-single-page/#post-14745695)
 * 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.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Insect Trojan](https://wordpress.org/support/users/insecttrojan/)
 * Last activity: [4 years, 10 months ago](https://wordpress.org/support/topic/exclude-code-from-a-single-page/#post-14745695)
 * Status: resolved