Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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().

share|improve this answer
    
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' ) ); –  RadGH Nov 1 '13 at 20:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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