Title: Function to hide widget
Last modified: September 4, 2017

---

# Function to hide widget

 *  Resolved [lananas1](https://wordpress.org/support/users/lananas1/)
 * (@lananas1)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/)
 * Hi,
    Does a hook exist to hide the widget? (i know that there is this one to 
   hide it if it’s empty: add_filter( ‘black_studio_tinymce_hide_empty’, ‘__return_true’);).
 * I want one that just hides, I would then add an IF statement to hide it on a 
   condition.
 * I have shortcodes in my widget to display custom fields, and sometimes the custom
   fields are empty, so I don’t want it to display if they are empty. The widget
   itself isn’t empty though because it has the shortcodes so the existing hook 
   above doesn’t work for me.
 * Thanks
    -  This topic was modified 8 years, 8 months ago by [lananas1](https://wordpress.org/support/users/lananas1/).

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

 *  Plugin Author [Marco Chiesi](https://wordpress.org/support/users/marcochiesi/)
 * (@marcochiesi)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/#post-9465561)
 * Hi [@lananas1](https://wordpress.org/support/users/lananas1/),
 * I’d suggest to use of the following approaches:
    1. The `sidebars_widgets` filter hook, which is a general purpose filter that allows
       you to filter all the widget types. See documentation [https://developer.wordpress.org/reference/hooks/sidebars_widgets/](https://developer.wordpress.org/reference/hooks/sidebars_widgets/)
    2. The [Widget Logic](https://wordpress.org/plugins/widget-logic/) plugin, which
       allows you to define conditions for each widget using your own PHP code.
        There
       are several other plugins for conditional widget display, but this one is the
       most dev-oriented.
 *  Thread Starter [lananas1](https://wordpress.org/support/users/lananas1/)
 * (@lananas1)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/#post-9468277)
 * Great, thanks for your help!
 *  [Jeffrey Carandang](https://wordpress.org/support/users/phpbits/)
 * (@phpbits)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/#post-9472352)
 * Hi Everyone,
 * You might want to check Widget Options : [https://wordpress.org/plugins/widget-options/](https://wordpress.org/plugins/widget-options/)
   for conditional widgets plugin. [@marcochiesi](https://wordpress.org/support/users/marcochiesi/)
   I hope you’ll love the plugin feature and will be able to recommend it instead
   of Widget Logic. Thank you very much!
 * Cheers,
    Jeffrey
 *  Plugin Author [Marco Chiesi](https://wordpress.org/support/users/marcochiesi/)
 * (@marcochiesi)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/#post-9472577)
 * Hi [@phpbits](https://wordpress.org/support/users/phpbits/),
    I just tested your
   plugin and at first sight it looks really good and complete. Thanks for the suggestions,
   I will definitely recommend it.
 *  [Jeffrey Carandang](https://wordpress.org/support/users/phpbits/)
 * (@phpbits)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/#post-9472705)
 * Thank you very much [@marcochiesi](https://wordpress.org/support/users/marcochiesi/),
   I’m really glad that you love the plugin features and thank you in advance for
   your recommendation 🙂
 * Cheers,
    Jeffrey

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

The topic ‘Function to hide widget’ is closed to new replies.

 * ![](https://ps.w.org/black-studio-tinymce-widget/assets/icon.svg?rev=2627604)
 * [Black Studio TinyMCE Widget](https://wordpress.org/plugins/black-studio-tinymce-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/black-studio-tinymce-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/black-studio-tinymce-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/black-studio-tinymce-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/black-studio-tinymce-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/black-studio-tinymce-widget/reviews/)

## Tags

 * [hide widget](https://wordpress.org/support/topic-tag/hide-widget/)

 * 5 replies
 * 3 participants
 * Last reply from: [Jeffrey Carandang](https://wordpress.org/support/users/phpbits/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/function-to-hide-widget/#post-9472705)
 * Status: resolved