Title: If Widget &#8211; Visibility control for Widgets
Author: Andrei
Published: <strong>25, Agostu de 2018</strong>
Last modified: 18, Xineru de 2021

---

Guetar plugins

![](https://ps.w.org/if-widget/assets/banner-772x250.png?rev=1930188)

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://ps.w.org/if-widget/assets/icon-256x256.png?rev=1930188)

# If Widget – Visibility control for Widgets

 By [Andrei](https://profiles.wordpress.org/andreiigna/)

[Download](https://downloads.wordpress.org/plugin/if-widget.zip)

 * [Details](https://ast.wordpress.org/plugins/if-widget/#description)
 * [Reviews](https://ast.wordpress.org/plugins/if-widget/#reviews)
 * [Development](https://ast.wordpress.org/plugins/if-widget/#developers)

 [Support](https://wordpress.org/support/plugin/if-widget/)

## Description

With [If Widget](https://layered.market/plugins/if-widget) you can control on which
pages widgets are shown. Show or hide widgets with custom visibility rules (no PHP
or technical knowledge required).

The plugin is easy to use, each widget will have a new option “Show widget only 
if” which will enable the selection of visibility rules (example in Screenshots).
Visibility rules can be combined with `AND`/`OR` to create even more personalised
visibility options.

#### Examples

 * Display a widget only if **User is logged in**
 * Hide widgets if **Is mobile device** `OR` **Visitor is from US**
 * Display widgets only for **Admins and Editors**
 * Hide Login or Register widgets for **Logged in Users**
 * Show widget only for **Admins** `AND` **Is not mobile device**

#### Visibility Rules

These are the visibility rules you can add for widgets:

 * User state: `User is logged in`
 * User role: `User is Admin or Editor` (plus all the available roles)
 * User registration: `User registration is allowed`
 * Post type: `Current post type is Post or Product`
 * Page type: `Current page is Front Page or Blog Page`
 * URL: `Current URL starts/ends with "this-page"`
 * URL: `Current URL contains with "keyword"`
 * Device detection: `Is mobile device`
 * Visitor location: `Visitor is from US or Spain` ✱
 * Visitor language: `Visitor language is English or Spanish` ✱
 * Third-party plugin integrations: `Show if user is in Group "Group Name"`, `Show
   if user has Subscription "Example Subscription"` and more ✱

#### More Visibility Rules Add-on

The paid Add-on provides more visibility rules and priority support.
 **Visibility
Rules**: unlock all visibility rules like: visitor location, membership status, 
user groups and more. A few examples are marked with ✱ above. **Support**: get one-
on-one email support for any questions you may have about installing and configuring
our plugins. Get [More Visibility Rules](https://layered.market/plugins/more-visibility-rules).

## Screenshots

 * [[
 * If Widget plugin demo
 * [[
 * Enable and choose visibility rules for Widgets
 * [[
 * Visibility rules
 * [[
 * Mix multiple visibility rules

## FAQ

### How can I enable custom visiblity for a widget?

On Widgets editing page, each widget will have a section for controlling visibility.
Enable the option “Show widget only if” to reveal and configure visibility rules(
Example in screenshots).

### How can I add a custom visibility rule for menu items?

New rules can be added by code in any other plugin or theme.

Example of adding a new custom rule for displaying/hiding a widget when current 
page is a custom-post-type.

    ```
    // theme's functions.php or plugin file
    add_filter('if_visibility_rules', 'my_new_visibility_rule');

    function my_new_visibility_rule(array $rules) {

      $rules['single-my-custom-post-type'] = array(
        'name'      =>  __('Single my-CPT', 'i18n-domain'),     // name of the condition
        'callback'  =>  function() {                            // callback - must return Boolean
          return is_singular('my-custom-post-type');
        }
      );

      return $rules;
    }
    ```

### Where can I find conditional functions?

WordPress provides [a lot of functions](https://codex.wordpress.org/Conditional_Tags)
which can be used to create custom rules for almost any combination that a theme/
plugin developer can think of.

## Reviews

![](https://secure.gravatar.com/avatar/564fd35cf3d8faca69db1f8b2db9696c7310c73b7d3b05e3e52db61ed950affc?
s=60&d=retro&r=g)

### 󠀁[Works better than the rest](https://wordpress.org/support/topic/works-better-than-the-rest-3/)󠁿

 [rsurfer](https://profiles.wordpress.org/rsurfer/) 18, Mayu de 2023

This is the only plugin that actually let me target by URL. Other plugins apparently
could, but none worked for me. This was the last plugin I was willing to try before
giving up. The interface is also simple and intuitive. I hope to see this plugin
become more popular!

![](https://secure.gravatar.com/avatar/2bfb6099271bd62afbdcde923a05383079998ad286b626f43ce0e35bcd1a3824?
s=60&d=retro&r=g)

### 󠀁[No longer works](https://wordpress.org/support/topic/no-longer-works-148/)󠁿

 [katypical](https://profiles.wordpress.org/katypical/) 27, Payares de 2021

Tried it. No options in the widget area. It appears this plug-in no longer works.

![](https://secure.gravatar.com/avatar/21425d200335d490df685fa8c0d6ed4e6a49cb8d8856d677ce7d09cbf0db19e0?
s=60&d=retro&r=g)

### 󠀁[This is Comprehensive!](https://wordpress.org/support/topic/this-is-comprehensive/)󠁿

 [fahmineo](https://profiles.wordpress.org/fahmineo/) 21, Avientu de 2020

I tried other plugins and not fullfil my needs. But, If Widget – Visibility control
for Widgets is the only exceptions. The main of my need is restrict widget for certain
user role, then this plugin solved my problem.

![](https://secure.gravatar.com/avatar/1536f94a378f8e8cbbfb15a0ba553df98647d1dd2d48078d20ef5f7932a47d96?
s=60&d=retro&r=g)

### 󠀁[Works fine but missing….](https://wordpress.org/support/topic/works-fine-but-missing/)󠁿

 [rangitoto](https://profiles.wordpress.org/rangitoto/) 18, Xunu de 2020

Plugin works fine but would be nice if I could choose something like: If post id
is…, or if category id is…., if tag is…. Or is it possible and I‘m searching too
far? cheers Rangi

![](https://secure.gravatar.com/avatar/2ad29ede7fbc558827427956f6568f50d1c414ba498179f234c9e1fef99ed4f3?
s=60&d=retro&r=g)

### 󠀁[This is perfect](https://wordpress.org/support/topic/this-is-perfect-17/)󠁿

 [frostyjpn](https://profiles.wordpress.org/frostyjpn/) 25, Abril de 2020

If you are trying the other widget control plugins, you are wasting your time. This
one is perfect.

![](https://secure.gravatar.com/avatar/652442e9caf6bb9574a856c63022f5902877a980af20d6eaa8d1fe2b0fdb702c?
s=60&d=retro&r=g)

### 󠀁[Lightweight, easy to use!](https://wordpress.org/support/topic/lightweight-easy-to-use-2/)󠁿

 [aptharsia](https://profiles.wordpress.org/aptharsia/) 7, Abril de 2020

Was looking for a simple plugin to hide widgets based on user role or if they were
signed in or not. This works flawlessly! Great work!

 [ Read all 9 reviews ](https://wordpress.org/support/plugin/if-widget/reviews/)

## Contributors & Developers

“If Widget – Visibility control for Widgets” is open source software. The following
people have contributed to this plugin.

Contributors

 *   [ Andrei ](https://profiles.wordpress.org/andreiigna/)

[Translate “If Widget – Visibility control for Widgets” into your language.](https://translate.wordpress.org/projects/wp-plugins/if-widget)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/if-widget/), check 
out the [SVN repository](https://plugins.svn.wordpress.org/if-widget/), or subscribe
to the [development log](https://plugins.trac.wordpress.org/log/if-widget/) by [RSS](https://plugins.trac.wordpress.org/log/if-widget/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 0.5 – 7 March 2020

 * Added – Visibility rule – Is Archive page (checks for year/month/category archive
   page)
 * Updated – Ensure compatibility with WordPress 5.4
 * Fixed – Vsibility rules control in Customizer

#### 0.4 – 24 October 2019

 * Updated – Text Visibility rule option: Text doesn’t contain
 * Updated – Ensure compatibility with WordPress 5.3

#### 0.3 – 5 July 2019

 * Added – Visibility rule – Users can register
 * Added – Support for paid Addon, which adds more visibility rules

#### 0.2 – 2 March 2019

 * Updated – Plugin texts
 * Updated – Compatibility with WordPress 5.1

#### 0.1

 * Plugin release. Includes basic visibility rules

## Meta

 *  Version **0.5**
 *  Last updated **5 años ago**
 *  Active installations **1.000+**
 *  Tested up to **5.6.17**
 *  PHP version ** 5.6 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/if-widget/)
 * Tags
 * [hide](https://ast.wordpress.org/plugins/tags/hide/)[roles](https://ast.wordpress.org/plugins/tags/roles/)
   [rules](https://ast.wordpress.org/plugins/tags/rules/)[visibility](https://ast.wordpress.org/plugins/tags/visibility/)
   [widget](https://ast.wordpress.org/plugins/tags/widget/)
 *  [Advanced View](https://ast.wordpress.org/plugins/if-widget/advanced/)

## Ratings

 4.4 out of 5 stars.

 *  [  7 5-star reviews     ](https://wordpress.org/support/plugin/if-widget/reviews/?filter=5)
 *  [  1 4-star review     ](https://wordpress.org/support/plugin/if-widget/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/if-widget/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/if-widget/reviews/?filter=2)
 *  [  1 1-star review     ](https://wordpress.org/support/plugin/if-widget/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/if-widget/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/if-widget/reviews/)

## Contributors

 *   [ Andrei ](https://profiles.wordpress.org/andreiigna/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/if-widget/)