Introduction to the Format API Edit

The purpose of this tutorial is to introduce you to the Format API. The Format API makes it possible for developers to add custom buttons to the formatting toolbar and have them apply a format to a text selection. Bold is an example of a standard button in the formatting toolbar.

In WordPress lingo, a format is a HTML tag with text-level semantics used to give some special meaning to a text selection. For example, in this tutorial, the button to be hooked into the format toolbar will let users wrap a particular text selection with the <samp> HTML tag.

If you are unfamiliar with how to work with WordPress plugins and JavaScript, you may want to check the JavaScript Tutorial first.

Table of Contents

  1. Register a new format
  2. Add a button to the toolbar
  3. Apply the format when the button is clicked
Skip to toolbar