admin-plugins author calendar category facebook post rss search twitter star star-half star-empty

Tidy Repo

The best & most reliable WordPress plugins

Free Restrict Widgets

Please read! This plugin has not been updated in over 6 months. It may no longer be maintained or supported. There may be compatibility issues when used with the latest version of WordPress. We suggest finding a similar, alternative plugin. Learn more about outdated plugins.

Restrict Widgets

Plugin Author: dFactory

Jay Hoffmann

March 12, 2014 (modified on May 21, 2018)

Admin, Widgets

If you use widgets extensively on your WordPress site, you might want to have a little more control over them then what is given to you out of the box. Restrict Widgets allows you to control who can access and edit your widgets, and chose what pages or posts each widget is shown on.

What’s It Do?

Restrict Widgets gives you two pieces of functionality. The first is global options for your Widgets, allowing you to specify who can access the widgets menu, what sidebars can be edited, and even what exact widgets can be edited by different user roles. The second is options for individual widgets that let you define which pages, categories, post types, or devices widgets should be shown on.

All of this can be edited right in the widgets menu by an Administrator.

How’s It Work?

When you install and activate the plugin, nothing will actually change. To start making changes to your widgets, go to Appearance -> Widgets. At the bottom of the page, you will see “Restrict Widgets” options to control who has access to widgets, and what they have access to.

The first row is “Restrict Users.” From there you can enter in the user roles on your site (Administrator, Editor, Author, etc.). Only users with the specified user roles will be able to access the Widgets menu. Otherwise, they will not even see it in the admin panel. Enter in as many user roles as you want to allow access. Below that is “Restrict Sidebars”. This controls which widgetized sidebars the users in “Restrict Users” will be able to see. An administrator will be able to see all of the sidebars, but if you enter in another sidebar then only administrators will be able to view them. So let’s say I have a sidebar called “Content Sidebar.” Pretty simple. Under “Restrict Users” I put Administrators and Editors and under “Restrict Sidebars” I put “Content Sidebar.” Logged in as an administrator I will be able to see everything. But if I am logged in as an editor, I’ll be able to view the main widgets area, but I won’t be able to see or edit the “Content Sidebar”. Pretty handy for WordPress installs with multiple widget types.

Restrict Widgets Screenshot Global Options

Global options for Restrict Widgets

Below this is “Restrict Widget Options”. If there are certain pages, categories, devices or user types (logged in or not logged in) on your site that you want a widget visible for no matter what, then add that to this list. That way, those editing the sidebars will not be able to add this parameter as an option. This may become more clear farther down. You can select a checkbox to group together widget option categories, which I recommend. You can also check a box to “Modify is_active_sidebar”. The problem with is_active_sidebar is that it will show a widget no matter what. If you’d like to correct this to respect Restrict Widget’s options, then check this box. If you are not using the function, then just leave it unchecked. Lastly, you can check a box to Remove all plugin data on deactivation” which is useful if you want to delete all of the data the plugin has stored.

Next, you can go to any widget to edit its individual restrictions. Click the down arrow next to any widget to open its panel of options. At the bottom, you will see a “Display/Hide Widget” section. The first option is a drop-down to either “Display Widget on selected” or “Hide Widget on selected.” From the menu below this, you will be able to select a number of different parameters. You will see a list of pages, a list of categories, two device groups (Mobile and Laptop / Desktop) and two user states (logged in or guest). You can add as many of these options as you want. If you selected “Display Widget on…” then users will only be able to see the widget you are editing if they are on the specific page, or in a post in the specific category, etc. If you selected “Hide Widget on…” then the opposite is true. It’s fairly straightforward, but make sure that you don’t get the two crossed.

...And each widget has it's own set of options

…And each widget has its own set of options

I will say one thing about choosing to display on mobile versus larger screens. The plugin uses some UX sniffing in order to determine what device a user is on. While this is fairly reliable, it is not right one hundred percent of the time, so make sure that you only use it if you have to.

When you are all finished choosing where to hide and display your widget, click the “Save” button. Then, you can just visit the front-end of your site to see the plugin in action.

There are lots of applications for this plugin, such as restricting certain sections for users only, showing contextual information, or even just limiting the number of sidebars you have to create. If you’re like me, you sometimes create multiple sidebars for different purposes, but with Restrict Widgets you can just set up one, then add some conditional logic to each.

Costs, Caveats, Etc.

Restrict Widgets is free and updated fairly often with small tweaks. The plugin developer is very active on the support forums, so make sure to go there if you are having a problem.

Resources

Plugin Info
  • Downloads: 128,481+
  • Downloads trend (30d): +4.0%
  • Active installations: 7,000+
  • Rating:
  • Last Update: January 18th, 2017
  • Download Plugin for Free