1

I've put an adsense script in the mu-plugins folder, hooked it to the option_active_plugins but it happens to be executed 6 times.

Is it an error?

5
  • Can you elaborate? Maybe post some code, and explain what you're trying to do as opposed to what you've done so far. Commented Oct 4, 2016 at 14:28
  • @TheDeadMedic: of course. Just a question.. is it "strange" that this hooks is called more than once?
    – Revious
    Commented Oct 4, 2016 at 14:59
  • 1
    No, not at all - this filter will fire anytime get_option( 'active_plugins' ) is called, which almost certainly happens multiple times per request. Commented Oct 4, 2016 at 15:00
  • For me would be enough as an answer. I think it stays very generic and will be useful for many other people. If you put it as an Answer I will accept it.
    – Revious
    Commented Oct 4, 2016 at 15:02
  • I understand that get_option('active_plugins') can be call many time. But in my case it's called 505 times! it seems too many. Or is my project too big?
    – dchang
    Commented Aug 26, 2019 at 15:13

1 Answer 1

5

is it "strange" that this hooks is called more than once?

No, not at all - this filter will fire anytime get_option( 'active_plugins' ) is called, which almost certainly happens multiple times per request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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