How To Restrict Widgets

Updated on February 27, 2024

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”:

  1. Using a block theme’s full site editor (FSE)
  2. 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:

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.

Cc V2 Sidebar Example Post 1024W

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 #

Cc V2 Sidebar Appearance Editor Menu 870W E1707974752376

2. Click Templates #

Cc V2 Sidebar Editor Templates 823W E1708050739110

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.

Cc V2 Sidebar Editor Templates Single 708W E1708050858201

4. Click Edit #

Cc V2 Theme Editor Templates Single Edit 711W E1708051054557

5. Click the List View icon #

Cc V2 Theme Editor Templates Single List View 1024W

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.

Cc V2 Sidebar Columns Column Selected 2 1024W

7. Click Block Controls #

Once you select the block you want to restrict, keep it selected and click Block Controls.

Block Settings Block Controls Expanded

8. Click Enable Controls #

Cc V2 Sidebar Columns Column Block Controls Enable 696W E1708051366462

9. Click Save #

Cc V2 Footer Edit Save 1 577W E1708051727457

10. Click Save #

Click Save once more to confirm.

Cc V2 Sidebar Single Save 2 696W E1708051907901

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.

1. Go to Appearance > Editor from your WordPress admin dashboard #

Cc V2 Sidebar Appearance Editor Menu 870W E1707974752376

2. Click Template Parts #

Cc V2 Theme Editor Template Parts 719W

Cc V2 Theme Editor Template Parts Footer 711W E1708052057773

3. Click Edit #

Cc V2 Theme Editor Templates Parts Footer Edit 704W E1708050944560

In our example below, we clicked on a Heading block.

Cc V2 Footer Edit Heading Block 1024W

5. Click Block #

Make sure you have your Block settings tab selected for the block you want to restrict.

Cc V2 Footer Edit Heading Block Settings 1024W

6. Click Enable Controls #

Cc V2 Footer Edit Heading Block Settings Enable Controls 1024W

Heads up!
If you don’t see your footer’s Block Controls settings, be sure Template Part is turned on in your Block Manager.

Cc V2 Settings Block Manager Template Part On 1024W

7. Click Save #

Cc V2 Footer Edit Save 1 577W

8. Click Save #

Click Save once more to confirm.

Cc V2 Footer Edit Save 2 619W E1708052432839

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 #

Cc V2 Appearance Widgets Selected 422W

2. Expand your sidebar widget #

Cc V2 Appearance Widgets Expand Sidebar 2 1024W

3. Click a block in your sidebar widget, then click Enable Controls #

Below, we enabled controls for a Heading block in our sidebar.

Cc V2 Appearance Widgets Sidebar Heading Enable Controls 272W

4. Click Update #

Cc V2 Appearance Widgets Sidebar Update 239W

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.

1. Go to Appearance > Widgets from your WordPress admin area #

Wp-Admin ≫ Appearance ≫ Widgets Menu

Cc V2 Widgets Footer Expand Marked 1024W

Below, we enabled controls for a Heading block in our footer.

Cc V2 Widgets Footer Heading Controls Enabled 262W

4. Click Update #

Cc V2 Widgets Footer Update 265W

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.

Is this article helpful? What are your feelings