noptin_clean( string|array $var )

Clean variables using sanitize_text_field.


Parameters Parameters

$var

(string|array) (Required) Data to sanitize.


Top ↑

Return Return

(string|array)


Top ↑

Source Source

File: includes/functions.php

function noptin_clean( $var ) {

	if ( is_array( $var ) ) {
		return array_map( 'noptin_clean', $var );
	}

	if ( is_object( $var ) ) {
		$object_vars = get_object_vars( $var );
		foreach ( $object_vars as $property_name => $property_value ) {
			$var->$property_name = noptin_clean( $property_value );
		}
		return $var;
	}

	return is_string( $var ) ? sanitize_text_field( $var ) : $var;
}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.3Introduced.

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation