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.
* @since 1.9.4 Removed Pro fields from the list. They loaded in the main Loader class.
// Include GDPR Checkbox field if GDPR enhancements are enabled.
if ( wpforms_setting( 'gdpr' ) ) {
$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 ) ) {
// We have to put it here due to tests for restricted emails.
new WPForms_Field_Email();