From 47f29436f025ef6fcb10b735ce5dc87b6086fae5 Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 12 Nov 2025 18:16:25 +0200 Subject: [PATCH] Fix default value for role metadata retrieval Ensure `get_option` returns an empty array as a fallback to prevent errors when metadata for a role does not exist. This resolves potential issues with undefined or unexpected data during role editing. --- includes/admin/templates/role/role-edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/admin/templates/role/role-edit.php b/includes/admin/templates/role/role-edit.php index 175ba84f..a750adba 100644 --- a/includes/admin/templates/role/role-edit.php +++ b/includes/admin/templates/role/role-edit.php @@ -55,7 +55,7 @@ if ( ! empty( $_GET['id'] ) ) { // roles e.g. "潜水艦subs" with both latin + not-UTB-8 symbols had invalid role ID $role_id = sanitize_title( $_GET['id'] ); - $data = get_option( "um_role_{$role_id}_meta" ); + $data = get_option( "um_role_{$role_id}_meta", array() ); if ( empty( $data['_um_is_custom'] ) ) { $data['name'] = $wp_roles->roles[ $role_id ]['name'];