Custom User Role: Can Edit Own Page, Cannot Create New

I’m not sure you are using the most correct way to restrict so maybe someone else can chime in but this if statement is grabbing the first role in the array which may be dealer or maybe another role if ( 'dealer' === $role_name ) {

Try instead if ($current_user->has_cap ('dealer')) { the has_cap function on a WP user will check the users capabilities AND roles https://codex.wordpress.org/Class_Reference/WP_User

Or this function https://codex.wordpress.org/Function_Reference/current_user_can

if (current_user_can('dealer'))

Also make sure that you have the correct capitalization ‘Dealer’ vs ‘dealer’

error code: 523