You can use has_action()
. It returns the priority of the hook if it exists, otherwise false
. So check that the priority is not equal to false
(and not just false-y, or being hooked at 0
will appear false) then use that to remove the hook.
$priority = has_action( 'publish_post', 'myCustomFunction' );
if ( $priority !== false ) {
remove_action( 'publish_post', 'myCustomFunction', $priority );
}
There’s also has_filter()
, which does exactly the same thing (has_action()
just calls has_filter()
).
Related Posts:
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- How can I see all the actions attached to an “add_action” hook?
- Registering Class methods as hook callbacks
- How to customize woocommerce related products? [closed]
- How to include code only on specific pages?
- Changing the “Plugin Activated” Message Default
- Hooking in to plugins
- Generate dormant hook references
- Schedule WordPress Auto-Updates to only run during business hours
- Better to fire specific hooks or generic hooks with parameters?
- How to only hook on Single.php after content?
- Remove action from plugin on other plugin
- Why does wp_enqueue_style() in plugin not load stylesheet?
- Preventing a plugin from updating
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- Is there any debug toolbar that shows whick hooks are called for the current page in WordPress?
- When can you get current page ID and initialize hooks right after?
- Customizing subject in comment notification e-mails
- How to save the values of checkbox to the register setting?
- Can we hook a static method of a class to add_action inside that class?
- Edit plugin without hooks in functions.php
- How can I log a user out of WordPress before the page loads?
- What is the ‘admin_action_’ . $_REQUEST[‘action’] hook used for?
- WP showing “warning: call_user_func_array()”, What to do?
- Filter out results from REST API
- How can I remove a hooked action created by a plugin?
- WordPress admin notice in plugin function
- Using the ‘draft_to_publish’ hook (post status transition)
- Filter Hook on plugin update
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Modify featured image URL at runtime
- WordPress Hook that will run when media file deleted
- Seeking clarification on page request life-cycle
- Disallow a user to post in certain categories
- Generic plugin (de)activation hook?
- Which hook should be used to validate custom form fields on the login form?
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- disable active plugins for specific theme
- Twillio How To Send SMS for Custom Post Type
- Hook (upgrader_process_complete) running moment
- Adding a form at the end of the content
- Hide WordPress Plugin Deactivation Links
- Find out if request is for custom post type archive before query runs
- Use external link in the add sub menu
- Pass A Value From Outside To A Plugin Variable
- Built in admin ajax hooks?
- Failed to invoke other hook from the init hook
- Does the ‘nav_menu_css_class’ filter accept 2 or 3 arguments?
- How can I add a custom meta value on file upload?
- Adding dynamic section to WordPress
- do_action and hook methods
- the_posts hook, which set of posts?
- How can I filter blog name?
- why does the add_action(‘the_content’) overwrite my page
- Fatal error: Class not found in
- Is it possible to add an action to the currently running action?
- woocommerce product attributes
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- Showing Notifications While Activating Plugin
- Display_rows() and column_cb() strange behaviour
- Transition Post status not working
- change output location of plugin function using a custom hook
- Plugin constructor called multiple times
- How to change value of $menu_class in ep_nav_menu?
- How to create and use Custom hooks
- functions.php conditional output for a single plugin
- Variable scope in plugin outside loop [closed]
- How to make plugin work in each template in wordpress
- Checking url from plugin [duplicate]
- OOP Plugin: Where should I place the action hooks in the class?
- How to display a link in the footer section
- add query string to all pages after user logged in
- How wordpress plugin hooks works? [duplicate]
- Post curl function save twice using plugin hook function wordpress
- User register hook can’t access form request
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- WordPress Hooks : Where to place callbacks that repetitively yield the same effect?
- Hook automatic_updates_complete to autoupdate plugin
- How to Add Extra Text In WordPress Title Before Post Publish
- Can’t use updated variables in handle function
- Neither update_option nor delete_option fires in deactivation hook
- Suitable hook when creating, updating and deleting posts programmatically
- Why is my activator class adding the files/running the actions I add?
- Change social icon in twenty twenty three theme
- is_user_logged_in() undefined at shutdown in plugin context
- Admin Notice is only localized when displaying the “Plugins” Backend Page
- WordPress : how to create onglet and remove it when only one
- Customize WP Filter Hook
- WordPress Action Hook inside Classes
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- Remove H1 title in admin post edit screen
- What is this async request in wordpress
- Preview for revision?
- What is the best way to override functions of thirdparty plugins?
- I have to select text from gutenberg editor. Purpose is to store and replace text
- Remove 3rd party plugin notices from within own plugin
- Similar hook to ‘init’ for when plugin page loads