We can use Shortcode API for creating WordPress shortcodes for use in posts and pages. The add_shortcode function is used to register a shortcode handler. It takes two parameters: the…