Shortcode Block

Go back to the list of Blocks

A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut.

The shortcode block can be added to a page by clicking on the Add Block button. It can be found in Widgets section. Alternatively, you can type /shortcode and press enter.

Add shortcodes with a slash command.

Detailed instructions on adding blocks can be found here.

Block Toolbar

Unlike other common blocks, the shortcode block does not include any specific settings in the block toolbar or editor sidebar.

Shortcode Block Editor Sidebar

Writing Your Shortcode

You may type your shortcode into the box provided or paste it from the available shortcodes.

The shortcode block interface.

More Options:

Hide Block Settings

The Hide Block Settings option hides (or shows) the Block Setting panel in the editor’s sidebar.

Copy

Copy can be used to copy a selected block and then you can paste it wherever you want in the editor.

Duplicate

Duplicate can be used to duplicate selected block.

Insert Before

Insert a new block before the selected block(s).

Insert After

Insert a new block after the selected block(s).

Move To

If you select Move To, you will get a blue line inside your content, you can then use the arrows to move that line up and down to where you want the selected content to be moved into, hitting return on your keyboard at that point moves the block to that position.

Edit as HTML

The Edit as HTML option allows you to modify the HTML code of the embed block.

Add to Reusable blocks

Using the Add to Reusable blocks option lets you add the selected block to a list of reusable blocks, so you can use them on other posts or pages as well.

Group

Select the Group option if you want to create a group of blocks and treat them as a unit. You can for instance add a common background color or other blocks to the group.

Remove Block

With the Remove Block option, you can delete the selected block from your content.

Block Settings

Every block has specific options in the editor sidebar in addition to the options found in the block toolbar. If you do not see the sidebar, simply click the ‘cog’ icon next to the Publish button.

As you can see, the shortcode block doesn’t include specific settings in the block settings.

You can transform a shortcode block into a group, so you can further apply custom settings to the block.

Color Settings

Text and background colors can be set on a per-block basis, allowing you to call attention to important content.

Via the “Custom Color” link you can further modify the color choice.

Accessibility parameters are built into the new editor to warn you when the text may become illegible for persons with reading impairments.

Advanced

The “Advanced” tab lets you add HTML anchor and CSS class(es) to your block.

The advanced section lets you add HTML anchor and a CSS class to your block.

“HTML anchor” allows you to make a unique web address for a particular “Shortcode” block. Then, you’ll be able to link directly to a “Shortcode” block of your page.

The “Additional CSS class(es)” lets you add CSS class(es) to your block, allowing you to write custom CSS and style the block as you see fit.

Changelog

  • Updated 2020-09-07
    • Updated 5.5 screenshot
    • Added block settings
    • Added changelog
    • Added more options
    • Added go to list block
  • Created 2019-03-07