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.
This commit is contained in:
Mykyta Synelnikov
2025-11-12 18:16:25 +02:00
parent 260cd5c239
commit 47f29436f0
+1 -1
View File
@@ -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'];