remove_action() does not work in some cases

Hi everyone,

I am having issues using remove_action() to hide an admin notice from the Easy Digital Downloads plugin in WordPress.

Below is an extract from the plugin source code:

    class EDD_Tracking {

	public function __construct() {

		add_action( 'admin_notices', array( $this, 'admin_notice' ) );

	}
$edd_tracking = new EDD_Tracking;

According to the WP documentation, the following code should remove the notice:

global $edd_tracking;
remove_action( 'admin_notices', array( $edd_tracking, 'admin_notice' ));

I also tried this:

 $edd_tracking = new EDD_Tracking;
remove_action( 'admin_notices', array( $edd_tracking, 'admin_notice' ));

and this:

remove_action( 'admin_notices', array( 'EDD_Tracking', 'admin_notice' ));

But none worked for some reason. Has anyone encountered similar issues, please?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.