Skip to content

Commit

Permalink
bail early when roles is not an array
Browse files Browse the repository at this point in the history
  • Loading branch information
vraja-pro committed Dec 4, 2024
1 parent 5e72ae6 commit bd10258
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion admin/capabilities/class-register-capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,12 @@ public function map_meta_cap_for_seo_manager( $caps, $cap ) {
return $caps;
}

if ( ! is_array( $user->roles ) ) {
return $caps;
}

// User must be of role wpseo_manager.
if ( ! in_array( 'wpseo_manager', ( $user->roles ?? [] ), true ) ) {
if ( ! in_array( 'wpseo_manager', $user->roles, true ) ) {
return $caps;
}

Expand Down

0 comments on commit bd10258

Please sign in to comment.