Reputation: 149
Trying to use the Advanced Category Excluder plugin and everything works great except on my 404 page I'm getting all of these "Undefined variable" errors on line 446
Line 446 reads return $filter;
In full context:
function ace_get_section()
{
global $wp_query, $ace_targets;
if (is_array($ace_targets))
{
foreach ($ace_targets as $key=>$val)
{
if (!empty($wp_query->$key) && $wp_query->$key == 1) $filter = $key;
}
}
return $filter;
}
Plugin Page http://wordpress.org/extend/plugins/advanced-category-excluder/
Anyone know how this can be resolved?
Upvotes: 1
Views: 222
Reputation: 6359
That $filter
variable is defined only when some conditions are met but when conditions are not met the variable is undefined as the notice says.
So try to add $filter="";
in the beginning of the function like this:
function ace_get_section()
{
global $wp_query, $ace_targets;
$filter="";
if (is_array($ace_targets))
{
foreach ($ace_targets as $key=>$val)
{
if (!empty($wp_query->$key) && $wp_query->$key == 1) $filter = $key;
}
}
return $filter;
}
Upvotes: 1