How to Add Shortcodes in the Block Editor

Shortcodes can be placed in a Page or Post using the WordPress core block called Shortcode.

To add shortcodes:

1. Go to the Page/Post that you want to add a shortcode to.

2. Click the Inserter (the + button in the top toolbar) or the inline Inserter, and type in “Shortcode”. Click the Shortcode block.

The Shortcode block searched inside the Inserter of the WordPress block editor

3. Type in your shortcode in the block that appears.

Adding a shortcode to the shortcode block

As an example, here is a shortcode that we want to add:

[video src="http://sandbox.local/wp-content/uploads/2023/01/wave_hi.mp4"]

And when we add that using the steps above it should be displayed just like this:

The published post with the shortcode displaying a video.

Leave a Reply

Your email address will not be published. Required fields are marked *