Skip to content

Commit b9ac6b2

Browse files
committed
added url validation
1 parent efcc4ec commit b9ac6b2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

functions/validate.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ function csf_validate_numeric( $value ) {
3535
}
3636
}
3737

38+
/**
39+
*
40+
* URL validate
41+
*
42+
* @since 1.0.0
43+
* @version 1.0.0
44+
*
45+
*/
46+
if( ! function_exists( 'csf_validate_url' ) ) {
47+
function csf_validate_url( $value ) {
48+
49+
if( ! filter_var( $value, FILTER_VALIDATE_URL ) ) {
50+
return esc_html__( 'Please write a valid url!', 'csf' );
51+
}
52+
53+
}
54+
}
55+
3856
/**
3957
*
4058
* Required validate

0 commit comments

Comments
 (0)