Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Use class method from existing plugin as action hook

Discussion in 'Troubleshooting & How-To's' started by Anna Villani, Jan 8, 2018.

  1. Anna Villani

    New Member

    Joined:
    Jan 8, 2018
    Messages:
    1
    Likes Received:
    0
    I'm using plugins called Groups and Groups File Access to handle file downloads on my site. I'd like to use one of the methods defined in this plugin as an action hook. I've tried
    add_action( array( "Groups_File_Access", "groups_file_served" ), "my_custom_function" )
    because the method is defined within a class, but this doesn't work.

    Is there a way to use an existing class method as a custom hook?

    I've seen many ways to hook a class method onto a native WP function, but not the other way around.
     
    #1

Share This Page

Monarch Social Sharing Plugin