Redirect Users who aren’t logged in, aren’t post authors and aren’t admin. Frontend

get_user_id() is not a function so you’ll get an error for that. Additionally, you can get the author id by calling the $post global and accessing the property post_author

add_action( 'template_redirect', 'redirect_non_permitted_users' );

function redirect_non_permitted_users () {
    if (is_admin()) return;
    $userID = get_current_user_id();
    global $post;
    $authorID = absint($post->post_author);
    
    if( $userID !== $authorID && ! is_user_logged_in() && ! is_front_page() && ! is_page('about') && ! is_page('pricing')){
        wp_redirect('https://www.example.com/no-permission/');
        exit;
    }
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)