Categories
WordPress

How to Exclude Specific Pages From the Pages WordPress Widgets

A celebrated aspect of WordPress is its ability to scale and automate things. Anyone sincere about their SEO efforts can surely appreciate this feature. However, in some cases, you might want to leverage this while excluding specific items.

From the many, one of these features is the capability of adding pages in WordPress widgets. For example, (screenshots to follow), on my website, if you look at my footer, I have a “Policies” column, where I am linking to my 4 policies. This is possible because, in my widgets, I’ve instructed WordPress to show my pages.

an example of pages being displayed in wp footer
The “policies” are pretty much pages in WP.
wp instructions to display pages in footer
What you see in the screenshot above is possible because I’ve instructed WP to do so from the “widgets” section.

This works out flawlessly for me, except for 1 part. I have more pages on my site, outside of just the policies — that I didn’t want to be displayed. So, I had to exclude them.

If it isn’t apparent already, from the second screenshot, the way to do so is plug-in the page IDs, and add them to the “exclude” section for the pages widget. So the real question is, how to find out page IDs? To discover so, follow the steps below:

You May Also Want to Check Out:

Step 1: Grab the ID Number While Creating a New Post, or if Existing, Edit the Page(s)

wp id number when creating a new page or post

Every time you create a new page, or a post, WP generates an ID number for it. I believe it’s what’s used for initial storage in the databases. This number will be visible in the URL. If you look at the screenshot above, the Id number for this page is 26775.

Now, let’s say you want to grab the Id number for an existing page, all you have to do is try to edit the page. Once you do so, you’ll see a similar URL structure, as shown in the image above. In an exactly similar fashion, the Id number will be displayed.

Step 2: Head Over to the Widgets, and Plug-In the Page IDs You Want to Exclude

If it wasn’t evident from the very first screenshot, the only remaining step now is to go to your widgets section in WordPress, and input the page IDs/a.k.a pages you don’t want to be displayed.

Then, all there’s left to do is hit save.

Conclusion

The way to exclude pages from the “pages” widget might slightly differ for your WordPress website. The reason for that would depend on your WP theme and whether you’re using any extra plugins.

Having that stated, if you are also using the WP Twenty Twenty theme like I am, without any additional plugins for widgets, what this post covers is precisely how it’ll likely be.

And there you have it folks; that’s how you can exclude specific pages from the pages WordPress Widgets.

Other Resources

  1. https://www.wpbeginner.com/glossary/widgets/
  2. https://wordpress.org/support/article/wordpress-widgets/