# Shortcodes Service

The shortcodes service is actually extremely similar [to the hooks service](/utilities-module/hooks-service.md) described previously. It's a [single-handler service](/foundations-module/utilities/handlers-and-services.md) with [a runnable and a resettable action](/foundations-module/actions.md). It provides the following public methods:

* `add_shortcode` - registers a shortcode with the handler
* `remove_shortcode` - removes a shortcode registered with the handler
* `remove_all_shortcodes` - removes all shortcodes registered with the handler

It accepts any handler implementing the [`ShortcodesHandlerInterface`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesHandlerInterface.php) and, just like the hooks service, comes with a default handler that first stores all registered shortcodes in an array and registers them with WP on the `run` action.

The similarities don't end there though! All the traits and interfaces mentioned for the hooks service are also available for the shortcodes service:

* [`ShortcodesServiceAwareInterface`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceAwareInterface.php) and [`ShortcodesServiceAwareTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceAwareTrait.php) for a getter/setter pair
* [`ShortcodesServiceRegisterInterface`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceRegisterInterface.php) and [`ShortcodesServiceRegisterTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Shortcodes/ShortcodesServiceRegisterTrait.php) for injecting the service externally
* [`InitializeShortcodesTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Actions/Initializable/InitializeShortcodesServiceTrait.php) for automagically setting the instance on the objec
* [`SetupShortcodesTrait`](https://github.com/deep-web-solutions/wordpress-framework-utilities/blob/master/src/includes/Actions/Setupable/SetupShortcodesTrait.php) for automagically calling the `register_shortcodes` method on setup


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://framework.deep-web-solutions.com/utilities-module/shortcodes-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
