File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -224,7 +224,7 @@ public function add_settings() {
224224$ this ->option_group ,
225225'cliowp_sp_input1 ' ,
226226array (
227- 'sanitize_callback ' => ' sanitize_text_field ' ,
227+ 'sanitize_callback ' => array ( $ this , ' sanitize_input1 ' ) ,
228228'default ' => 'input1 test ' ,
229229)
230230);
@@ -293,6 +293,24 @@ public function input1_html() {
293293<?php
294294}
295295
296+ /**
297+ * Undocumented function
298+ *
299+ * @param string $input The input value.
300+ */
301+ public function sanitize_input1 ( $ input ) {
302+ if ( true === empty ( $ input ) ) {
303+ add_settings_error (
304+ 'cliowp_sp_input1 ' ,
305+ 'cliowp_sp_input1_error ' ,
306+ __ ( 'Input1 cannot be empty ' , 'cliowp-settings-page ' ),
307+ );
308+ return get_option ( 'cliowp_sp_input1 ' );
309+ }
310+
311+ return sanitize_text_field ( $ input );
312+ }
313+
296314/**
297315 * Undocumented function
298316 */
You can’t perform that action at this time.
0 commit comments