Title: Function to check for visibility
Last modified: August 22, 2016

---

# Function to check for visibility

 *  Resolved [profilpr](https://wordpress.org/support/users/profilpr/)
 * (@profilpr)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/function-to-check-for-visibility/)
 * Hi, is there a plugin function I could use to check for widgets to be allowed
   for a page?
 * I currently use the wordpress function “is_active_sidebar” which returns true
   if widgets are assigned to it. But it misses the fact that the widgets might 
   be disallowed via the dynamic widgets plugin.

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

 *  Plugin Contributor [Qurl](https://wordpress.org/support/users/qurl/)
 * (@qurl)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/function-to-check-for-visibility/#post-5834541)
 * You can check if the widget is (going to be) removed in the $DW->removelist array
 *  Thread Starter [profilpr](https://wordpress.org/support/users/profilpr/)
 * (@profilpr)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/function-to-check-for-visibility/#post-5834586)
 * Hi thanks for your reply. That did the trick!
 * I am using the following in my themes functions.php:
 *     ```
       function sidebar_has_active_widgets($sidebar) {
         include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
         if ( is_plugin_active('dynamic-widgets/dynamic-widgets.php') ) {
           $DW = &$GLOBALS['DW'];
           if (!empty($sidebar) && is_array($DW->removelist) && array_key_exists($sidebar, $DW->removelist)) {
             return false;
           }
         }
         return true;
       }
       ```
   

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

The topic ‘Function to check for visibility’ is closed to new replies.

 * ![](https://ps.w.org/dynamic-widgets/assets/icon-256x256.png?rev=2968917)
 * [Dynamic Widgets](https://wordpress.org/plugins/dynamic-widgets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dynamic-widgets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dynamic-widgets/)
 * [Active Topics](https://wordpress.org/support/plugin/dynamic-widgets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dynamic-widgets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dynamic-widgets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [profilpr](https://wordpress.org/support/users/profilpr/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/function-to-check-for-visibility/#post-5834586)
 * Status: resolved