This is in regards to the plugin Theme My Login, although the question may relate to any plugin. The author says he no longer uses the support forum, so I've come here.

I'm trying to unhook the following action, found in /modules/custom-passwords/custom-passwords.php on line 38.

class Theme_My_Login_Custom_Passwords extends Theme_My_Login_Abstract {
   protected function load() {
      add_action( 'register_form', array( &$this, 'password_fields' ) ); // Unhook This!

Now I've tried a bunch of versions of the remove_action function, but none seem to work. Every time I have used remove_action before it has been with a variable, but TML is using the class directly.

I have tried the following in directly before the do_action('register_form') function call. None seem to work.

remove_action('register_form', array( Theme_My_Login, 'password_fields' ) );

remove_action('register_form', array( Theme_My_Login_Custom_Passwords, 'password_fields' ) );

// get_object() is a method of the original class, and returns the 
// object which can be var_dump'd
remove_action('register_form', array( Theme_My_Login::get_object(), 'password_fields' ) );

I know this is the action I need to remove, as I can comment it out within the plugin file and it solves the issue. But I don't want to edit the plugin file, obviously, because I want to keep the plugin updated.


1 Answer 1


You have the right idea with using get_object() just on wrong class. Since hooked method belongs to Theme_My_Login_Custom_Passwords instance it should be Theme_My_Login_Custom_Passwords::get_object().

  • 1
    That should have been obvious... I swear that's the one combination I didn't try. This worked for me though, thank you! I'll accept the answer in 3 minutes... Working code: remove_action('register_form', array( Theme_My_Login_Custom_Passwords::get_object(), 'password_fields' ) ); Nov 1, 2013 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.