MISTOOLS

WordPress Shortcode Builder

Build a shortcode with safely escaped attribute values, and get the PHP to run it in a template.

How it works

  1. Enter the shortcode name.
  2. Add attributes and optional content.
  3. Copy the shortcode or the PHP snippet.

About this tool

A shortcode is a small tag in square brackets that WordPress turns into content, for example a gallery or a form. Values can break a shortcode if they contain quotes or square brackets, so they must be escaped.

This tool builds the shortcode, escapes quotes, brackets and angle brackets in values, checks the names and warns about repeated attributes. It also gives a do_shortcode PHP line for theme templates. It does not run the shortcode and does not need your site.

Questions

How do I use a shortcode?

Paste it into a post, page or Shortcode block. In a theme file, use do_shortcode().

Why are quotes escaped?

A double quote inside a value would end the value early and break the shortcode.

Does this create a new shortcode?

No. It writes the tag text. A plugin or your theme must register the shortcode name.

More tools

More free Developer tools