0

How would I go about overriding an option using the pre_option_ filter before a plugin loads? I am trying to do something like the below, but I can't do it in the wp_config file, because the add_filter function has not loaded yet, and I can't do it in the functions.php file in my theme because the plugin has already loaded at that point.

if (STAGE == 'local') {
    function rlrsssl_options() {
        return array();
    }
    add_filter('pre_option_rlrsssl_options', 'rlrsssl_options');
}

1 Answer 1

1

If you have code that must run before plugins are loaded, place it in a Must Use Plugin. This is just a PHP file placed in wp-content/mu-plugins/. Be aware that Must Use Plugins are activated just by existing.

Your Answer

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

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