What’s in This Guide
In this how-to guide, you’ll learn how to restrict a sidebar and footer “widget”. There are 2 main ways WordPress themes support “widgets”:
- Using a block theme’s full site editor (FSE)
- Managing widgets under Appearance > Widgets
We’ll describe how to add widget restrictions in both ways.
If your theme doesn’t support full site editing (FSE), you’ll need to manage your sidebars and footers under Appearance > Widgets.
We’ll cover adding a restriction to the following:
- Content inside a sidebar using the site editor (Appearance > Editor).
- A footer template part using the site editor (Appearance > Editor).
- A sidebar widget block using Appearance > Widgets.
- A footer widget block using Appearance > Widgets.
Since the sidebar and footer content are all blocks, we’ll follow the same steps for adding a restriction to a block in the block (Gutenberg) editor.
That includes accepting the Device Rules (show on all devices) and User Rules (any logged-in role can view).
Adding a Restriction to a Sidebar Using the Site Editor
We based the steps below using the sidebar example from the official Building Sidebars With the Site Editor WordPress tutorial. That means we’ll work with a sidebar inside a column block in the single (i.e., posts) template.
For reference, here’s what our post sidebar looks like on the front end of our site.
A post sidebar example with a search, heading, and latest posts block inside it.
Ready? Let’s get to it!
1. Go to Appearance > Editor from your WordPress admin dashboard
2. Click Templates
3. Click Single
We want to protect the sidebar content for all blog posts. All blog posts use the Single template. So we must edit the Single template.
4. Click Edit
5. Click the List View icon
6. Expand the Columns block and click your sidebar Column block
Following the official WordPress sidebar tutorial, we have 1 Columns block with 2 Column blocks inside. Click the Column block that has your sidebar.
Keep the Column block selected, or click any block you want to restrict inside that column.
7. Click Block Controls
Once you select the block you want to restrict, keep it selected and click Block Controls.
8. Click Enable Controls
9. Click Save
10. Click Save
Click Save once more to confirm.
You’re done! Congrats 🎉
Now, only logged-in visitors (by default) can see the sidebar when they bring up posts on your blog.
Do you want to restrict different devices and roles? Learn more about Block Controls in our how-to guide.
Adding a Restriction to a Footer Using the Site Editor
1. Go to Appearance > Editor from your WordPress admin dashboard
2. Click Template Parts
2. Click Footer
3. Click Edit
4. Click a block inside your footer that you want to restrict
In our example below, we clicked on a Heading block.
5. Click Block
Make sure you have your Block settings tab selected for the block you want to restrict.
6. Click Enable Controls
Heads up!
If you don’t see your footer’s Block Controls settings, be sure Template Part is turned on in your Block Manager.
7. Click Save
8. Click Save
Click Save once more to confirm.
Nicely done 👏🏼
Now, only logged-in visitors (by default) can see the footer content you just restricted when they bring up your site.
Do you want to restrict different devices and roles? Learn more about Block Controls in our how-to guide.
Adding a Restriction to a Sidebar Widget
1. Go to Appearance > Widgets from your WordPress admin area
2. Expand your sidebar widget
3. Click a block in your sidebar widget, then click Enable Controls
Below, we enabled controls for a Heading block in our sidebar.
4. Click Update
Awesome job 🎉
Now, only logged-in visitors (by default) can see the footer content you just restricted when they bring up your site.
Do you want to restrict different devices and roles? Learn more about Block Controls in our how-to guide.
Adding a Restriction to a Footer Widget
1. Go to Appearance > Widgets from your WordPress admin area
2. Expand your footer widget
3. Click a block in your footer widget, then click Enable Controls
Below, we enabled controls for a Heading block in our footer.
4. Click Update
Hooray 🎉
Now, only logged-in visitors (by default) can see the footer content you just restricted when they bring up your site.
Do you want to restrict different devices and roles? Learn more about Block Controls in our how-to guide.
What’s Next?
Since you made it this far, learn how to restrict your site’s header content next.