| @@ -60,11 +60,11 @@ | ||
| 60 | 60 | * |
| 61 | 61 | * @return bool |
| 62 | 62 | */ |
| 63 | 63 | private function is_editor_mode() { |
| 64 | - // Check if we're in Gutenberg editor | |
| 65 | - return defined( 'REST_REQUEST' ) && REST_REQUEST && | |
| 66 | - isset( $_REQUEST['context'] ) && $_REQUEST['context'] === 'edit'; | |
| 64 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- REST request context check. | |
| 65 | + $context = isset( $_REQUEST['context'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['context'] ) ) : ''; | |
| 66 | + return defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $context; | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public function view_params() { |
| 70 | 70 | $htags = []; |