Disabling Conditional Logic on the Edit Entry page

If you have a particular use case and need to disable the conditional logic on the Edit Entry page, there's a filter that allows that:

add_filter( 'gravityview/edit_entry/conditional_logic', '__return_false' );

When using this filter, fields that were supposed to be hidden will keep their values when editing the entry.

If you need the code above to run only on certain Views:

add_filter( 'gravityview/edit_entry/conditional_logic', 'gk_disable_conditional_logic' );
function gk_disable_conditional_logic(){
    
    $run_on_views = [100,200]; //Change this to the IDs of the Views you'd like to run this filter [100,200,300,...]
    $view_id = GravityView_View::getInstance()->getViewId();

    if( in_array( $view_id, $run_on_views ) ){
        return false;
    }
    return true;
    
}

If you are not sure where to add this code, please check this article.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us