Title: Use class method from plugin as action hook
Last modified: January 9, 2018

---

# Use class method from plugin as action hook

 *  Resolved [anvi7924](https://wordpress.org/support/users/anvi7924/)
 * (@anvi7924)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/use-class-method-from-plugin-as-action-hook/)
 * Hi, I’m using the WordPress Groups and Groups File Access plugins to handle file
   access and downloads on my site. The Groups File Access plugin has a class called“
   Groups_File_Access”, and within that class a method called “groups_file_served”.
 * My goal is to trigger a custom function whenever that method gets called from
   the plugin. In my functions.php file, I test the existence of the method with
   method_exists(“Groups_File_Access”, “groups_file_served”) and it returns true.
 * I essentially want to do something like add_action( array(“Groups_File_Access”,“
   groups_file_served”), “my_custom_function”) but haven’t been successful with 
   this. Any help or suggestions would be greatly appreciated!
 * Thanks,
 * Anna

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/use-class-method-from-plugin-as-action-hook/#post-9845481)
 * Please identify exactly which plugin you are using and then post in that plugin’s
   dedicated forum via its page in the [Plugin Repository](https://wordpress.org/plugins/).
   So the plugin’s developers and support community can help you with this.
 *  Thread Starter [anvi7924](https://wordpress.org/support/users/anvi7924/)
 * (@anvi7924)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/use-class-method-from-plugin-as-action-hook/#post-9847406)
 * Okay, I’ve done that as well. MY question here is I guess a more general one.
   I want to know if it is possible to use a class method as an action hook.
 * Something like add_action( array( “name_of_class”, “name_of_method” ), “my_callback_function”)
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/use-class-method-from-plugin-as-action-hook/#post-9848115)
 * Topic continues here:
    [https://wordpress.org/support/topic/use-class-method-as-action-hook/](https://wordpress.org/support/topic/use-class-method-as-action-hook/)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Use class method from plugin as action hook’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/use-class-method-from-plugin-as-action-hook/#post-9848115)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
