A shortcode is a snippet of PHP code that serves as a placeholder in your content. Using shortcodes is a quick and easy way to add functionality to your site without writing code.
You can use shortcodes to add buttons to your posts, pages, and widgets, or even pull in content from an API. Simply place them in the page code, and the browser will call and integrate the associated content when a user requests that page.
For example, when a user requests a page that uses the [video] shortcode, the underlying PHP will generate all the code required to display the video and the controls for playing it.
WordPress currently includes these shortcodes:
- [ embed ]
In addition, some themes also come with their own shortcodes. However, they may stop working if you switch themes. Advanced users can make their own shortcodes by defining new functions for them within a theme’s functions.php file.
The Shortcode Reference plugin provides a list of the shortcodes available in your current WordPress installation and details on how to use them.