Mr. Jo
Mr. Jo

Reputation: 5261

Remove license message in Wordpress

I'm trying to disable the license notification for a plugin a bought a few months ago. Now my license for updates is not longer valid but I don't want to receive any updates anymore because I've changed a lot in the plugin. This is the message:

enter image description here

I've tried to remove it this way:

add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
function filter_plugin_updates( $value ) {
    unset( $value->response['cred-frontend-editor/plugin.php'] );

    return $value;
}

But when I refresh the page the notification is still there. How can I remove it?

Upvotes: 0

Views: 2853

Answers (1)

janw
janw

Reputation: 6662

This depends on the plugin. But the steps I would take.

  1. Search to plugin codebase for variations of add_action( 'admin_notices', 'callback_notice function')
  2. Then try to use remove_action to de-hook that notice. Keep in mind remove_action has to run after the add_action, So if that add_action is done inside an add_action('admin_init', ...,10) (prio 10) you should run the remove action in an add_action('admin_init', ...,11)
    Yes this part is confusing.

Good luck

Edit

Given the code you provided the remove should be:

add_action( 'init', function() {
    remove_action( 'admin_notices', array( WP_Installer::instance(), 'setup_plugins_page_notices' ) );
    remove_action( 'admin_notices', array( WP_Installer::instance(), 'setup_plugins_renew_warnings' ), 10 );
    remove_action( 'admin_notices', array( WP_Installer::instance(), 'queue_plugins_renew_warnings' ), 20 );
}, 100);

The add_actions are run in the init function. the init function is hooked in the , well the init hook, at default priority (10)

So we run the removes after that in the init hook at prio 11.

Probably you don't need to remove the setup_plugins_page_notices hook.

Upvotes: 2

Related Questions