Check sidebar conditional tag exists
Return false for non-existent conditional tags. Fixes #993
This commit is contained in:
@@ -30,10 +30,13 @@ class Roots_Sidebar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function check_conditional_tag($conditional_tag) {
|
private function check_conditional_tag($conditional_tag) {
|
||||||
if (is_array($conditional_tag)) {
|
$conditional_arg = is_array($conditional_tag) ? $conditional_tag[1] : false;
|
||||||
return $conditional_tag[0]($conditional_tag[1]);
|
$conditional_tag = $conditional_arg ? $conditional_tag[0] : $conditional_tag;
|
||||||
|
|
||||||
|
if (function_exists($conditional_tag)) {
|
||||||
|
return $conditional_arg ? $conditional_tag($conditional_arg) : $conditional_tag();
|
||||||
} else {
|
} else {
|
||||||
return $conditional_tag();
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user