1. Home
  2. Snippets
  3. Change the captcha math for the Custom Captcha Addon

Change the captcha math for the Custom Captcha Addon

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Dismiss

The Custom Captcha addon can be setup to display a math captcha for users to solve. The settings of this type of captcha can be adjusted using a filter.

The example snippet below changes the max number used to 4 which will simplify the equations. The cal could also be modified to only include addition.

/**
 * Adjust math captcha settings.
 *
 * @params array $settings
 * @return array
 */
function wpf_dev_math_captcha_settings( $settings ) {
	
	/* Default settings
		array(
			'min' => 1,
			'max' => 15,
			'cal' => array( '+', '*' ),
		);
	 */

	// Change max number 4 for easier math
	$settings['max'] = 4;

	return $settings;
}
add_filter( 'wpforms_math_captcha', 'wpf_dev_math_captcha_settings' );

Related

Updated on January 17, 2018

Was this article helpful?