Description
The wpforms_enable_form_data_slashing
filter allows developers to enable or disable the slashing of form data in the WPForms builder. When enabled, this filter prevents the removal of backslashes in form fields after saving and refreshing the form.
Parameters
- $enabled
- (bool) Determines whether form data slashing should be enabled. If
true
, backslashes in form fields will be preserved. Iffalse
, backslashes may be removed during form processing..
Source
wpforms/includes/functions/forms.php
More Information
WPForms may remove backslashes from form field content when the form is saved and reloaded in the builder by default. This can cause issues with certain types of content that rely on backslashes, such as file paths or regular expressions.
When enabled, this filter ensures that backslashes are preserved when saving and refreshing a form in the builder, duplicating a form, converting a form to a template, or creating a new form from a template.
Example
/**
* Enable form data slashing in WPForms.
*
* @link https://wpforms.com/developers/wpforms_enable_form_data_slashing
*
* @param bool $enabled Default value for form data slashing.
* @return bool
*/
function wpf_enable_form_data_slashing( $enabled ) {
return true;
}
add_filter( 'wpforms_enable_form_data_slashing', 'wpf_enable_form_data_slashing' );