Skip to content

Instantly share code, notes, and snippets.

@LaurenaRehbein
Created October 17, 2016 22:53
Show Gist options
  • Save LaurenaRehbein/85dd9dcb52f0435027511300df6fcb92 to your computer and use it in GitHub Desktop.
Save LaurenaRehbein/85dd9dcb52f0435027511300df6fcb92 to your computer and use it in GitHub Desktop.
Validate your WooCommerce integration settings.
public function validate_api_key_field( $key, $value ) {
if ( isset( $value ) && 20 < strlen( $value ) ) {
WC_Admin_Settings::add_error( esc_html__( 'Looks like you made a mistake with the API Key field. Make sure it isn&apos;t longer than 20 characters', 'woocommerce-integration-demo' ) );
}
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment