Sure, that’s called has_action
, which is an alias of has_filter
. Usage:
if ( has_action('hook_name') ) {
throw new \Exception('You cannot hook to a protected action.');
} else {
do_action('hook_name');
}
These two functions access the global array $wp_filter
that stores all of the filters / actions
Related Posts:
- Trouble understanding apply_filters()
- How many filter/action hooks are healthy?
- Earliest hook to reliably get $post/$posts
- What does (10, 2) mean when used with add_filter
- Valid characters for actions, hooks and filters
- How to make post and comment count unclickable with dashboard_glance_items hook
- Hook into admin post list page
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- About Hooks and Filters
- Should I use add_action(‘publish_post or add_filter(‘publish_post?
- Please explain me what the do_action does
- Too many actions/filters!
- How to get list of all hooks of current theme / plugin?
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- Conditionally call add_action depending on post_type?
- Is it possible to track down Actions and Filters?
- When to use actions and when to use filters
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- Same Conditionals Not Working on Two Different Hooks
- How to call a function or method that is Namespaced using another plugin
- add filter login_redirect does not contain original requested redirect
- get_header and hook avoid normal call
- Can the wp_filter object hold multiple values with the same key
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- apply_filters/do_action tag characters limit
- Filter taxonomy admin pagination
- Insert term when page is published – avoid duplicates after edits
- Capture post content before page renders
- How to remove action with slashes and arrows?
- Changing WordPress core without hacking core
- Comment search plugin
- How can I output all apply_filters and do_action?
- Remove actions/filters that are set with create_function()
- Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
- Remove tags without a specific meta key from “choose from the most used tags”
- How to access page variable inside action hook
- What is the action hook to use if you want to capture the new password during password change?
- Use has_filter on comment_post
- How can I edit comment meta value before it is saved?
- Action hook to control access to certain parts of my site
- Replace Data In Post & Update Meta Field Post Is Saved
- style_loader_tag not changing stylesheet to preload
- Hook to change the site URL
- Hook to add content after date in post?
- Hook inside a hook
- Can you call a filter hook by “add_action”?
- Passing a parameter to filter and action functions
- Difference Between Filter and Action Hooks?
- How to know what functions are hooked to an action/filter?
- Get a list of all registered actions
- WordPress hooks/filters insert before content or after title
- How can I edit post data before it is saved?
- add_action(), add_filter() before or after function
- How do filters and hooks really work in PHP
- What is the very earliest action hook you can call?
- wp_headers vs send_headers. When to use each?
- Is there any action filter/hook for validating a custom field before publishing the post?
- Filter specific shortcode output?
- How to pass/get data to/from the WooCommerce data-product_variations object?
- Remove Editor From Homepage
- Where to hook into post content?
- Clarification on filters and hooks
- How to only hook on Single.php after content?
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- How to hook into unregistering a widget instance?
- Implementing advanced add_* function wrappers
- Is it possible to use object in add_action?
- Passing Additional Parameters to add_filter Callable
- What hook do I use to edit the post statuses option in admin?
- Filter hook before create order WooCommerce
- Modify WordPress Rest Api Request/Response
- How to add some custom HTML into wordpress admin bar?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- Custom theme hooks / filters – passing arguments
- wp_mail – Remove sitename from email subject
- How do I Make a Theme “plugin-ready”?
- Store source permalink on XMLRPC calls
- How to disable all WordPress emails modularly and programatically?
- How to hook wp_list_pages?
- apply_filters() slices away needed arguments
- WP Rest API – Upload media without saving attachment post
- How to use the_excerpt in a filter hook?
- How to add attribute to output with wp_video_shortcode add_filter
- How to change Woocommerce breadcrumbs content?
- How do I know if author field was changed on post save?
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- How can I hide all posts that don’t have a thumbnail?
- Change text of Description in Image Library
- Load different template file when condition met?
- Using hooks to place content in theme dynamically
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Am I using the right hook for removing quicktags on the admin TinyMCE?
- How to debug removal of rewrite rule flushing?
- How to enable visual editor when editing comments on the dashboard?
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Is it possible to create an action hook using do_action() within add_action()?
- Is it possible to Hook/Filters Attachment Creation?
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- Filter all html output