Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To use a shortcode in a WordPress sidebar, add it to a Shortcode block in a block-based widget area, or put it in a built-in Text widget and save. The shortcode must be registered by WordPress, your active theme, or an active plugin; otherwise the bracketed tag may appear as plain text.
Choose the right widget method
| Widget setup | What to do | PHP needed? |
|---|---|---|
| Block-based widget area | Add a Shortcode block and enter the tag, including brackets. | No |
| Built-in Text widget | Enter the shortcode in the widget content and save. Current WordPress core processes shortcodes in visual Text widgets. | No |
| Legacy Text widget that prints the tag literally | Use the legacy filters in the order shown below. | Yes |
The Shortcode block is documented as a widgets-category block for inserting custom elements with a shortcode. Its availability and the editor interface can vary by WordPress version and theme. WordPress Shortcode block reference.
Add a shortcode to a block-based sidebar
- Confirm the plugin or theme feature that provides the shortcode is active, and check its documentation for the exact tag.
- Open the site’s widget editor or the block-theme widget area.
- Add a Shortcode block, enter the tag with its square brackets—for example,
[my_shortcode]—and save. - View a page that displays the sidebar and check the rendered result.
WordPress.org’s plugin directory notes that block widgets run shortcodes on WordPress 5.8 and above; exact labels and controls still depend on the site’s setup. WordPress.org plugin directory.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Add a shortcode to a WordPress Text widget
- Open the widget editor and locate the built-in Text widget used in the sidebar.
- Paste the registered shortcode into the widget content, preserving the brackets, then save.
- Open a page with that sidebar to verify the output.
Current WordPress core processes shortcodes in visual Text widgets through widget_text_content. The core Text widget implementation applies do_shortcode() after paragraph formatting and also has separate handling for legacy mode. WordPress core: WP_Widget_Text.
Enable shortcodes in a legacy Text widget
If a legacy Text widget displays the shortcode literally, the WordPress Codex documents these filters in this order:
add_filter( 'widget_text', 'shortcode_unautop' );
add_filter( 'widget_text', 'do_shortcode' );
shortcode_unautop runs first to prevent automatic paragraph markup from interfering with shortcode parsing; do_shortcode then expands registered tags. Add PHP only if needed, preferably through a site-specific plugin or a child-theme code area, and have someone comfortable editing PHP manage it. WordPress Codex: widget_text filter.
Rank #2
What a shortcode needs in order to work
A shortcode is a registered tag, not just text inside square brackets. A plugin, theme, or core component must register the tag and provide a handler. WordPress documents add_shortcode( $tag, $func ) for registration and do_shortcode( $content ) for replacing registered shortcode macros with their handler output. If no matching tag is defined, do_shortcode() returns the content without filtering, which is why an unavailable or misspelled tag often remains visible. WordPress Shortcode API handbook and WordPress: do_shortcode().
Fix a shortcode that is not working in a sidebar widget
- The sidebar shows
[tag]literally: Check that the provider plugin or theme feature is active and that the tag spelling matches its documentation. Only registered tags are expanded. - It works in a post but not in the sidebar: Test the built-in Text widget or Shortcode block. A third-party widget may use a different content hook and may not process shortcodes through
widget_text. - Paragraphs or markup look wrong around the output: If this is a legacy Text widget, use
shortcode_unautopbeforedo_shortcode. - Adding an old snippet causes duplicate or inconsistent output: Current visual Text widgets already have core shortcode handling, and core suspends duplicate legacy handling in that mode. Remove unnecessary legacy filters and test again.
- You cannot find a Shortcode block: Use the Text widget if available, or check the WordPress version, active theme, and widget editor mode. The block reference describes the block but does not guarantee identical controls on every site.
The widget_text hook filters Text widget content and accepts the text, instance settings, and widget object. Its reference records the hook’s introduction in WordPress 2.3.0 and the $widget parameter in 4.4.0. A custom widget may use a different integration point. WordPress: widget_text.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

