REST API & Custom Shortcodes
Connecting WordPress to the Outside World
The REST API and shortcodes both extend what WordPress can do, one by exposing data externally, the other by adding reusable content snippets inside the editor.
The WordPress REST API
The REST API exposes site data, such as posts, pages, and users, as JSON, allowing external apps or a decoupled frontend to read and write content.
It's commonly used to power mobile apps, headless WordPress sites, or integrations with other software.
Creating Custom Shortcodes
A shortcode is a bracketed tag, like [my_shortcode], that WordPress replaces with dynamic content or a specific function's output.
Register a custom shortcode using add_shortcode() in functions.php, then insert it into any post or page.
| Feature | Purpose | Common Use |
|---|---|---|
| REST API | Exposes site data as JSON | Mobile apps, headless frontends |
| Shortcode | Inserts dynamic content via a tag | Reusable buttons, forms, embeds |
One of the most common uses of shortcodes and plugins together is building contact forms, so let's look at the top options for that.
Ready to master WordPress Training Course?
Join Uncodemy's hands-on, mentor-led WordPress training and build real, live websites.