Shortcodes, Widgets and Blocks

Browse manual On this page × Wordpress Manual WordPress Fundamentals Toggle WordPress Fundamentals section What Is WordPress? WordPress.org vs WordPress.com What Can You Build with WordPress? How WordPress Works WordPress Core, Themes, Plugins and Content Essential WordPress Terminology How to Plan a WordPress Website Domains, Hosting, DNS and HTTPS Explained How to Choose WordPress Hosting…

3 min read

  • Article
  • 3 minutes read
  • Reviewed August 3, 2026

Shortcodes, widgets and blocks are three ways WordPress plugins can expose reusable functionality to editors.

They belong to different generations and interface models, but all remain relevant on existing websites. Choosing the correct mechanism affects editing experience, portability, frontend output and long-term maintenance.

Shortcodes

A shortcode is a text token placed in content, commonly using square brackets.

For example:

[example_form id="42"]

WordPress recognizes the shortcode tag and calls a registered handler to generate output.

Shortcodes are compact and work in many text-based contexts. They are useful for legacy integrations and simple dynamic output. Their limitations include poor visual editing, hidden parameters and raw shortcode text when the providing plugin is disabled.

A shortcode handler should return output rather than printing unexpectedly, validate attributes and use a prefixed tag to reduce name collisions.

Classic Widgets

Classic widgets are configurable components traditionally placed in theme-defined widget areas such as sidebars and footers.

Examples include recent-post lists, search forms and custom HTML.

Modern WordPress provides a block-based Widgets Editor where supported, with compatibility for legacy widgets. Classic widget systems remain important on many classic themes, but new projects increasingly use blocks and block template areas.

Blocks

Blocks are structured editor components with defined attributes, controls and saved or dynamic output.

A plugin block can provide:

  • Visual previews.
  • Inspector controls.
  • Semantic structured attributes.
  • Reusable styling options.
  • Server-side rendering.
  • Interactive frontend behavior.
  • Integration with patterns and templates.

Blocks generally provide a clearer editing experience than shortcodes because users can select and configure them directly.

Static and Dynamic Blocks

A static block saves its frontend markup into post content. A dynamic block stores attributes and renders output on the server when requested.

Dynamic blocks are useful when output must remain current, depend on permissions or query live data. Static blocks can remain visible even if the plugin is disabled, although editing support and styles may be lost.

Portability and Lock-In

Each mechanism creates different dependencies.

  • Shortcodes can leave visible tokens.
  • Legacy widgets may disappear when a theme has no matching widget areas.
  • Dynamic blocks may stop rendering without the plugin.
  • Static blocks may preserve HTML but lose controls and styling.

Document what happens when functionality is removed and avoid storing essential information only inside opaque attributes.

Which Should New Plugins Use?

For editor-facing components, blocks are normally the preferred modern interface.

Shortcodes remain appropriate when:

  • Backward compatibility is required.
  • The feature must work in a shortcode-aware legacy context.
  • A text representation is genuinely useful.

Classic widgets should mainly be maintained for compatibility or theme workflows that still depend on widget areas.

A plugin can support more than one interface while using one shared rendering layer.

Accessibility and Performance

The output must be accessible regardless of the editing mechanism.

Blocks should use semantic markup and keyboard-accessible controls. Shortcodes and widgets need the same frontend standards.

Load scripts and styles only where the component is used when practical. Registering a block does not justify loading a large frontend bundle on every page.

Frequently Asked Questions

Are shortcodes deprecated?

No. They remain supported, although blocks provide a more modern editing model for many use cases.

Are widgets the same as blocks?

No. Blocks can be used in widget areas through the block-based editor, while legacy widgets use the older widget API.

Can a plugin provide both a shortcode and a block?

Yes. Both can call the same underlying service or renderer.

Continue Learning

Previous: Must-Use Plugins Explained

Next: WordPress Hooks, Actions and Filters