Special Offer
Save up to 20%
on any purchase
Grab the Deal
blog left design shape
How to Add a Shortcode in WordPress

How to Add a Shortcode in WordPress

If you want to add a shortcode in WordPress, then you need to know how to do it. But you don’t know how to get it done, right? 

Shortcodes are a great way to customize your website without having to write code. Many WordPress plugins and themes use shortcodes to add specialized content like contact forms, image galleries, sliders, and more. 

In this article, we’ll cover the basics of adding a shortcode in WordPress with very little effort. So, let’s dive deep into the article.

What are Shortcodes?

Shortcodes are a feature of WordPress that allows you to easily insert content into a post or page. A shortcode is simply a block of code that you insert into a post or page, and WordPress will automatically create the necessary HTML and CSS for you. Moreover, they are code shortcuts, allowing you to add dynamic content to WordPress posts, pages, and sidebar widgets. They are enclosed with square brackets, for example: [ourshortcode]

You can also use shortcodes to generate values for data input fields on posts and pages. They’re easy to use, and you can create a wide variety of custom tags using shortcodes.

Here are some examples of how you might use shortcodes to create custom content:

To create a simple blog post header, you could use the following shortcode: [header name]

This would output the header name for the current post, which is “Header 1.” You could also specify other attributes like class names and colors using this same syntax. For example, [header color=”blue”] would produce the blue header color for your post.

How to Add a Shortcode in WordPress Posts and Pages 

At first, the page and the post where you add the shortcode should be edited in the right way. Then click on the add block button to insert a shortcode block.

How to Add a Shortcode in WordPress- Add a shortcode in WordPress

After adding the shortcode block, you can simply enter your shortcode in the block settings. The different types of WordPress plugins that you might be using like Directorist, Product Carousel Slider and Grid Ultimate Pro for WooCommerce, Logo Showcase Ultimate Pro, Post Grid, Slider and Carousel Ultimate Pro, Legal Pages Pro, Akismet Spam Protection, Jetpack, Easy Table Rate Shipping Pro for WooCommerce etc. provide shortcode for you.

How to add a shortcode in WordPress- adding shortcode in WordPress posts and pages

Now, save the changes and preview your posts and pages and see your shortcode functioning.

How to Add a Shortcode in WordPress Sidebar Widgets

Adding a shortcode to your WordPress sidebar widgets is a quick and easy way to add extra functionality to your site. In the lines below, we’ll show you how to add a shortcode to your sidebar widget’s menu so that you can easily create custom menus for your site’s content.

To do that, simply visit the Appearance>> Widgets pages and add a ‘Shortcode’ widget block to a sidebar. Now you can paste your shortcode inside the text area of the widget. 

How to add a shortcode in WordPress- Adding shortcode in the WordPress sidebar widgets

Don’t forget to click on the ‘Update’ button to store your widget settings.

How to add a shortcode in WordPress- Adding shortcode in the WordPress sidebar widgets and then update

After that, you can visit your WordPress website to see the live preview of the shortcode in the sidebar widget. 

How to Add a Shortcode in Old WordPress Classic Editor

If you’re a WordPress user who’s used the classic editor for creating posts, you may be familiar with how to add shortcodes. But, somehow you didn’t know it, then here is how you can add a shortcode to the old editor.

First, open up your post or page in the classic editor. You’ll see a block of text near the bottom that looks like this: [ourshortcode]. This is where you’ll enter your shortcode.

How to add a shortcode in WordPress- Adding shortcode in old WordPress classic editor

Finally, don’t forget to save the changes. And, preview the post and page to see your shortcode functioning.


We hope this article helped you learn how to add a shortcode in WordPress. If you follow the steps we mentioned in our article above, we believe you will surely learn how to add a shortcode in WordPress website with the utmost possible ease. 

If you liked this post, don’t forget to subscribe to our blog so that we can notify you once any post is published. Finally, you can also follow wpWax on FacebookTwitter, and LinkedIn for more exciting news, offers, and product updates.

Written by

Md Hamim Khan

Md Hamim Khan is a man of letters who puts up his hands for technical content writing at wpWax. He loves to keep himself engaged in playing cricket & chit-chatting with friends, family, and colleagues in the time when he leaves out of work.


  • Patrick
    September 25, 2022 5:03 pm

    This is not super helpful; it would be nice to show how the block looks like after the shortcode has been entered.
    Beginners don’t know
    1) if the brackets are part of the shortcode or not,
    2) if you enter both the opening and closing tabs in the same block or in 2 different blocks, like
    [shortcode] xxx something inside xxx [\shortcode]

  • Md Hamim Khan
    September 26, 2022 8:32 am

    Hey Patrick,
    Thanks for your kind words and valuable suggestions. I have updated the content so that everybody from beginners to seasoned ones can get the most out of it.

Leave a Reply