quform_element_visible

This hook can be used to change the visibility of an element. Elements that are not visible are not shown in the form or processed.

quform_element_visible_X_X

This hook is run for a single element.

Example

12
3
4
5
6
7
add_filter('quform_element_visible_1_3', function ($visible, Quform_Element $element, Quform_Form $form) {    if (is_user_logged_in()) {
        $visible = false;
    }
 
    return $visible;
}, 10, 3);
add_filter('quform_element_visible_1_3', function ($visible, Quform_Element $element, Quform_Form $form) {
    if (is_user_logged_in()) {
        $visible = false;
    }

    return $visible;
}, 10, 3);
1
2
3
4
5
6
7
8
9
function my_element_visible($visible, Quform_Element $element, Quform_Form $form)
{
    if (is_user_logged_in()) {
        $visible = false;
    }
 
    return $visible;
}
add_filter('quform_element_visible_1_3', 'my_element_visible', 10, 3);
function my_element_visible($visible, Quform_Element $element, Quform_Form $form)
{
    if (is_user_logged_in()) {
        $visible = false;
    }

    return $visible;
}
add_filter('quform_element_visible_1_3', 'my_element_visible', 10, 3);

quform_element_visible

This hook is run for all elements.

Example

1
2
3
4
5
6
7
add_filter('quform_element_visible', function ($visible, Quform_Element $element, Quform_Form $form) {
    if (is_user_logged_in()) {
        $visible = false;
    }
 
    return $visible;
}, 10, 3);
add_filter('quform_element_visible', function ($visible, Quform_Element $element, Quform_Form $form) {
    if (is_user_logged_in()) {
        $visible = false;
    }

    return $visible;
}, 10, 3);
1
2
3
4
5
6
7
8
9
function my_element_visible($visible, Quform_Element $element, Quform_Form $form)
{
    if (is_user_logged_in()) {
        $visible = false;
    }
 
    return $visible;
}
add_filter('quform_element_visible', 'my_element_visible', 10, 3);
function my_element_visible($visible, Quform_Element $element, Quform_Form $form)
{
    if (is_user_logged_in()) {
        $visible = false;
    }

    return $visible;
}
add_filter('quform_element_visible', 'my_element_visible', 10, 3);

Parameters

  • $visibleboolean – whether the element is currently visible or not
  • $elementQuform_Element – the element instance
  • $formQuform_Form – the form instance
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy