To show a widget on some pages only, use a widget visibility plugin. WordPress core has no page-by-page rules. Core can hide a block on desktop, tablet or mobile screens.
Classic Admin Screens
Widget Options adds visibility rules to classic widgets and to blocks. For example, you can show a Text and Maps widget on the contact page only.
- Go to PluginsAdd Plugin, then install and activate Widget Options.
- Go to AppearanceWidgets and open a widget or block.
- Set the visibility rules the plugin adds to it.
- Click Save on the classic screen, or Update on the block-based screen.

The plugin also adds the same rules to widgets used in Page Builder by SiteOrigin.
The Jetpack plugin has a Widget Visibility module. Turn the module on. Each widget then gets a Visibility button with Show and Hide rules. Jetpack has many modules. To start with none active, see disabling all modules in one go.
Customizer
The plugins above add their rules to widgets in the Customizer as well. The screen-size rule of the block-based screen works there too.
- Go to AppearanceCustomizeWidgets and open a widget area.
- Select the widget. On the block-based screen, select the block and open the block options menu (three dots).
- Click Hide. Check Hide on Desktop, Hide on Tablet or Hide on Mobile, then click Apply.
- Click Publish.

The Hide rule depends on screen size only. It is a block option, so it does not apply to widgets on the classic screen. Use a plugin for rules by page.
Block Themes
A block theme normally has no widget areas. Blocks in templates and template parts take their place. Hide a block on some screens with the same Hide option.
- Go to AppearanceEditorTemplates and open a template.
- Select the block and open the block options menu (three dots).
- Click Hide. Check Hide on Desktop, Hide on Tablet or Hide on Mobile, then click Apply.
- Click Save.

To show a block on one page only, edit that page and add the block to it. Widget Options also adds page rules to blocks.