Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable plugin with filter #6

Closed
roopemerikukka opened this issue Nov 2, 2018 · 3 comments
Closed

Disable plugin with filter #6

roopemerikukka opened this issue Nov 2, 2018 · 3 comments
Assignees
Labels

Comments

@roopemerikukka
Copy link

Could it be possible to disable the plugin by using filter? I can make PR if wanted. This would be great when in example you don't want to run the plugin in admin. Here is an example:

wps.php:

<?php

if( apply_filters( 'wps_disable', false ) ) {
  return;
}

Users functions.php:

<?php

if( is_admin() ) {
  add_filter( 'wps_disable', '__return_true' );
}
@Rarst
Copy link
Owner

Rarst commented Nov 2, 2018

What would be the cases when it's preferable to control it with filter over WP_DEBUG_DISPLAY ? Think I need to poke and see if that's convenient for conditional definition...

@Rarst Rarst self-assigned this Nov 2, 2018
@Rarst Rarst added the question label Nov 2, 2018
@Rarst
Copy link
Owner

Rarst commented Nov 2, 2018

Also you could stop it by telling whoops to unregister, quick snippet I tried that seems to get it done:

add_action( 'admin_init', function () {
	global $wps;
	$wps['run']->unregister();
} );

Would that work for your needs?

@roopemerikukka
Copy link
Author

Yep thats exactly the case. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants