Table of contents
Get the industry’s fastest hosting for WordPress◦ 99.999% uptime
◦ Comprehensive security
◦ 24/7 support

WordPress GuideBuild → do_shortcode

do_shortcode – What it means in WordPress & how to use it

Want to unlock extra features in WordPress without installing a dozen plugins? There’s a simple function that lets you insert advanced functionality wherever you need it—even inside template files. If you’re ready to tap into more of what WordPress shortcodes can do, you’ll want to get familiar with this hidden gem.

Get fast, reliable hosting for WordPress

Power your site with the industry’s fastest, most optimized WordPress hosting

What is the do_shortcode?

do_shortcode is a WordPress PHP function that lets you run a shortcode directly in your theme files, plugins, or anywhere PHP is allowed. Normally, shortcodes are used inside post or page content. But with do_shortcode, you can call those same shortcodes outside of the content editor—like in sidebars, custom page templates, or even headers and footers.

This is especially helpful when you’re building a custom theme or plugin and want to use a shortcode without manually inserting it into a post or widget. Instead of relying on the block editor or Classic Editor, you can run the shortcode programmatically.

How the do_shortcode works

Using do_shortcode is straightforward. Here’s how to do it:

Troubleshooting do_shortcode

If do_shortcode isn’t working as expected, check the following:

Additional resources

How to build a WordPress site →

A complete beginner’s guide that covers 9 key steps to a successful launch

WordPress Slug: What is it and what should you do with it? →

Learn how to create and customize WordPress slugs for better SEO and user-friendly URLs.





How to use WordPress Gutenberg blocks →

A complete beginner’s guide to Gutenberg blocks