: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( ! defined( 'ABSPATH' ) ) {
* Primary class constructor.
public function __construct() {
* @since 1.8.2 Moved base class loading to \WPForms\WPForms::includes.
private function hooks() {
// Load default fields on WP init.
add_action( 'init', [ $this, 'load' ] );
* Load default field types.
// Include GDPR Checkbox field if GDPR enhancements are enabled.
if ( wpforms_setting( 'gdpr', false ) ) {
$fields[] = 'gdpr-checkbox';
* Filters array of fields to be loaded.
* @param array $fields Field types.
$fields = (array) apply_filters( // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
foreach ( $fields as $field ) {
$file = WPFORMS_PLUGIN_DIR . 'includes/fields/class-' . $field . '.php';
if ( file_exists( $file ) ) {
$pro_file = WPFORMS_PLUGIN_DIR . 'pro/includes/fields/class-' . $field . '.php';
if ( wpforms()->is_pro() && file_exists( $pro_file ) ) {
// We have to put it here due to tests for restricted emails.
new WPForms_Field_Email();