How to Show WordPress Widgets only on Certain Pages

Published On: January 23rd, 2012|Last Updated: January 7th, 2023|Categories: Web Design|Total Views: 1677|Daily Views: 1|
If you add any widget to your site, it will be displayed in all the pages of your site by default. But there is necessity to display some widgets only on certain pages like advertisements, announcements and much more. WordPress has provided conditional tags to overcome this problem. So, if you want to show widgets only on certain pages, just follow the below steps. In the below example, I configure widget to display only on category pages and not in any other pages:


  1. Download Widget Logic plugin from WordPress and install it in your site and activate the plugin.
  2. After activating the plugin, navigate to Dashboard–>Appearance–>Widgets.
  3. Choose any one of the widget, which you want to show only on category page.
  4. Now you can find a small text box below every widgets with label “Widget Logic”.
  5. Enter is_category() in the text box without double quotes as shown in the below image.
    From now, that widget only appears in the category page and it will not be displayed in any other pages. If you want to display the widget only on one category page, then do the following steps:

    • Find that particular category id. (If you don’t know how to find, then read this)
    • If the category id is 9, then enter is_category(‘9’) in the widget logic box.

    From now that widget will appear only on that particular category page.

More Customization

  1. If you want to display widget in more than one category page, then use conditional tag as “in_category( array( 1,2,3) )“.
  2. If you decide not to display on certain category pages then just add “!” in front the conditional tag as “! in_category( array( 1,2,3) )“.
  3. If you want to display widget in both category page as well as in home page then add “&&” between them like “is_category() && is_home()“.

Most Used Conditions

Is_home() – only on homepage.

Is_category() – only on category pages.

Is_single() – only on post pages.

Is_page() – only on pages.

Is_search() – only on search page To find all the conditional tags, just go to Conditional Tags Codex.

Leave A Comment