Validate an option array
-
02-11-2019 - |
Question
We use the default WordPress register_setting()
function to validate theme options. This call, for example:
register_setting( 'options-group', 'option1', 'intval' );
Will validate whether or not $option1
is an integer.
What can I use to pass an array of options to validate each member of the array?
For example:
$options = array(
'options1' => 4, // intval
'options2' => '127.0.0.1', // IP address
'options3' => 'test@test.com' // Email address
);
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange