Skip to main content
deleted 1 character in body
Source Link
TheDeadMedic
  • 36.6k
  • 9
  • 68
  • 102

You are trying to unhook a PHP function as opposed to a ( classclass) instance method - see here:

array( $this, 'job_manager_job_filters_distance' )

...that's the actual callback registered to the hook. To unhook you need the same (a reference to the instance).

If you are trying to unhook from within the class, it's as easy as using the above. Otherwise you need a reference to the instance - look for something like the following in your code:

$my_class = new Name_Of_Class;

...then you'd run:

remove_action( 'job_manager_job_filters_search_jobs_end', array( $my_class, 'job_manager_job_filters_distance' ) , 0 );

You are trying to unhook a PHP function as opposed to a ( class) instance method - see here:

array( $this, 'job_manager_job_filters_distance' )

...that's the actual callback registered to the hook. To unhook you need the same (a reference to the instance).

If you are trying to unhook from within the class, it's as easy as using the above. Otherwise you need a reference to the instance - look for something like the following in your code:

$my_class = new Name_Of_Class;

...then you'd run:

remove_action( 'job_manager_job_filters_search_jobs_end', array( $my_class, 'job_manager_job_filters_distance' ) , 0 );

You are trying to unhook a PHP function as opposed to a (class) instance method - see here:

array( $this, 'job_manager_job_filters_distance' )

...that's the actual callback registered to the hook. To unhook you need the same (a reference to the instance).

If you are trying to unhook from within the class, it's as easy as using the above. Otherwise you need a reference to the instance - look for something like the following in your code:

$my_class = new Name_Of_Class;

...then you'd run:

remove_action( 'job_manager_job_filters_search_jobs_end', array( $my_class, 'job_manager_job_filters_distance' ) , 0 );
Source Link
TheDeadMedic
  • 36.6k
  • 9
  • 68
  • 102

You are trying to unhook a PHP function as opposed to a ( class) instance method - see here:

array( $this, 'job_manager_job_filters_distance' )

...that's the actual callback registered to the hook. To unhook you need the same (a reference to the instance).

If you are trying to unhook from within the class, it's as easy as using the above. Otherwise you need a reference to the instance - look for something like the following in your code:

$my_class = new Name_Of_Class;

...then you'd run:

remove_action( 'job_manager_job_filters_search_jobs_end', array( $my_class, 'job_manager_job_filters_distance' ) , 0 );