Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

require_once(APP_PATH.BLOG_FOLDER.'wp-load.php');

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;
    var_dump($adrotate_config);

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

require_once(APP_PATH.BLOG_FOLDER.'wp-load.php');
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.

share|improve this question

closed as too localized by s_ha_dum, Rarst May 31 '13 at 17:09

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

1 Answer 1

up vote 0 down vote accepted

OK FIXED using

define('WP_USE_THEMES', false);
require_once(APP_PATH.BLOG_FOLDER.'wp-blog-header.php');

instead of wp-load.php

share|improve this answer
add comment

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