Skip to main content
added 459 characters in body
Source Link

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.

EDIT:

I'm using plugins called Groups and Groups_File_Access to handle file access and downloads on my site. The class is "Groups_File_Access"" and the method inside is "groups_file_served". I did not write this plugin. That method gets triggered when someone accesses a file and I want to run a custom function when "groups_file_served" get called by hooking onto it. Was trying to avoid editing the plugin itself, but looks like I'm going to need to.

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.

EDIT:

I'm using plugins called Groups and Groups_File_Access to handle file access and downloads on my site. The class is "Groups_File_Access"" and the method inside is "groups_file_served". I did not write this plugin. That method gets triggered when someone accesses a file and I want to run a custom function when "groups_file_served" get called by hooking onto it. Was trying to avoid editing the plugin itself, but looks like I'm going to need to.

added 4 characters in body
Source Link
rudtek
  • 6.3k
  • 5
  • 30
  • 52

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.

Source Link

Can I use a method from an existing plugin as an action hook?

I want to use a method from a plugin as a hook, not the callback. I want to use a custom function I wrote as the callback, that gets triggered when a particular method from a plugin runs. Essentially something like :

add_action( array( "NAME OF CLASS", NAME OF METHOD" ), "MY CUSTOM FUNCTION" ) )

I can't figure out how to do this, any help or direction would be greatly appreciated!

I've verified the method and class exist in functions.php with the method_exists() function.