I'm using Gravity Forms User Registration add-on and need to remove the action that include the activate page.
In the add-on, the hook is called like this:
add_action( 'wp', array( $this, 'maybe_activate_user' ) );
This is added inside a public function called init()
, a method from GF_User_Registration
class.
What I tried:
add_action('init', function () {
remove_action('wp', ['GF_User_Registration', 'maybe_activate_user']);
});
$this
, so you need to know and be able to access the object (i.e. class instance) in order to unhook themaybe_activate_user
function. E.g. If they did$object = new GF_User_Registration;
, then you would useremove_action( 'wp', [ $object, 'maybe_activate_user' ] )
. But regarding how to find that class instance, you need to check the plugin forums/docs/codebase.get_instance()
. I tried run$object = \GF_User_Registration::get_instance();
and thenremove_action('wp', [$object, 'maybe_activate_user']);
but didn't have success.init
with a greater number as the 3rd parameter, e.g.add_action( 'init', <your function>, 20 )
. Or just hook your function onwp
with a1
priority -add_action( 'wp', <your function>, 1 )
. That should work, if you're using the correct class instance.