Shortcodes Service
Last updated
Was this helpful?
Last updated
Was this helpful?
The shortcodes service is actually extremely similar described previously. It's a with . 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 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:
and for a getter/setter pair
and for injecting the service externally
for automagically setting the instance on the objec
for automagically calling the register_shortcodes
method on setup