OK so I'm trying to use the plugin "adrotate" outside of the loop for my frontend.

I can access all the WP functions I need for everything else using


The plugin has a function called adrotate_group() which is just in a script file, no class or anything.

function adrotate_group($group_ids, $fallback = 0, $weight = 0) {
    global $wpdb, $adrotate_config, $adrotate_debug;

This outputs NULL when I call it like so on my frontend

echo adrotate_group(1);

$adrotate_config is setup in another setup script for this plugin and I've done some var_dumps there and it outputs to my frontend correctly.

Below is where the variable is set

enter image description here

For some reason using global $adrotate_config in that function isn't working, however using get_option('adrotate_config'); does, but I cannot go edit all of the plugin functions to use this as it will break on updates.

I think it has to do with the way I'm hooking wordpress.


OK FIXED using

define('WP_USE_THEMES', false);

instead of wp-load.php

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