| @@ -455,18 +455,20 @@ | ||
| 455 | 455 | 'type' => 'array', |
| 456 | 456 | 'description' => __( 'Cron job parameters', 'wp-data-access' ), |
| 457 | 457 | 'sanitize_callback' => function ( $param ) { |
| 458 | 458 | $params = array(); |
| 459 | - foreach ( $param as $key => $value ) { | |
| 460 | - if ( 'params' === $key || 'notify' === $key ) { | |
| 461 | - // Sanitize custom parameters | |
| 462 | - $custom_params = array(); | |
| 463 | - foreach ( $value as $param_key => $param_value ) { | |
| 464 | - $custom_params[sanitize_text_field( $param_key )] = sanitize_text_field( $param_value ); | |
| 459 | + if ( is_array( $param ) ) { | |
| 460 | + foreach ( $param as $key => $value ) { | |
| 461 | + if ( 'params' === $key || 'notify' === $key ) { | |
| 462 | + // Sanitize custom parameters | |
| 463 | + $custom_params = array(); | |
| 464 | + foreach ( $value as $param_key => $param_value ) { | |
| 465 | + $custom_params[sanitize_text_field( $param_key )] = sanitize_text_field( $param_value ); | |
| 466 | + } | |
| 467 | + $params[sanitize_text_field( $key )] = $custom_params; | |
| 468 | + } else { | |
| 469 | + $params[sanitize_text_field( $key )] = sanitize_text_field( $value ); | |
| 465 | 470 | } |
| 466 | - $params[sanitize_text_field( $key )] = $custom_params; | |
| 467 | - } else { | |
| 468 | - $params[sanitize_text_field( $key )] = sanitize_text_field( $value ); | |
| 469 | 471 | } |
| 470 | 472 | } |
| 471 | 473 | return $params; |
| 472 | 474 | }, |