Title: PHP : remove a section
Last modified: February 19, 2020

---

# PHP : remove a section

 *  Resolved [Benjamin Pongy AXOME](https://wordpress.org/support/users/redpik/)
 * (@redpik)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/php-remove-a-section/)
 * Hi,
    Can I remove a section by ID in PHP ? Maybe with **before_render** hook ?
   I want to remove it (or just the content), not to hide it. Thank you for your
   help.

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

 *  [pingram](https://wordpress.org/support/users/pingram3541/)
 * (@pingram3541)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/php-remove-a-section/#post-12456657)
 * I found this in _/includes/base/element-base.php_ starting at line 601, public
   function ‘_print\_element_‘ appears to be the control mechanism of whether something
   renders.
 * Within this function is a filter:
 * _$should\_render = apply\_filters( “elementor/frontend/{$element\_type}/should\
   _render”, $should\_render, $this );_
 * So you might be able to check _$type = $this->get\_name()_ to confirm the element
   type is a ‘_section_‘ and then $settings = _$this->get\_settings()_ and check
   to ensure $settings[‘_element_id’] matches a custom section CSS id and then pass
   $should_render as false to keep THAT section from rendering based upon your custom
   PHP condition(s).
 * I have not tested any of this. Best of luck an success to you.
 *  [pingram](https://wordpress.org/support/users/pingram3541/)
 * (@pingram3541)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/php-remove-a-section/#post-12456838)
 * Working on this problem myself – [https://github.com/elementor/elementor/issues/4246](https://github.com/elementor/elementor/issues/4246)
 * Only way I found to do my own conditional logic is to use Elementor Pro’s shortcode
   way of rendering sections and globals, then one can perform any back end logic
   choosing whether to return or echo out the do_shortcode(‘[elementor…]’) somewhere
   within the theme files.
 *  Thread Starter [Benjamin Pongy AXOME](https://wordpress.org/support/users/redpik/)
 * (@redpik)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/php-remove-a-section/#post-12458942)
 * Thank you pingram, I will follow the tread on GitHub.
    Have a nice day.

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

The topic ‘PHP : remove a section’ is closed to new replies.

 * ![](https://ps.w.org/elementor/assets/icon-256x256.gif?rev=3444228)
 * [Elementor Website Builder - more than just a page builder](https://wordpress.org/plugins/elementor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/elementor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/elementor/)
 * [Active Topics](https://wordpress.org/support/plugin/elementor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/elementor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/elementor/reviews/)

## Tags

 * [hook](https://wordpress.org/support/topic-tag/hook/)
 * [section](https://wordpress.org/support/topic-tag/section/)

 * 3 replies
 * 2 participants
 * Last reply from: [Benjamin Pongy AXOME](https://wordpress.org/support/users/redpik/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/php-remove-a-section/#post-12458942)
 * Status: resolved