What are the potential risks of running a WordPress 5.8 (BETA) on a live site?

Running a WordPress 5.8 (BETA) on a live site can pose risks such as compatibility issues with plugins and themes, potential bugs or errors that could affect the functionality of the site, and security vulnerabilities that may not be fully addressed in the beta version. To mitigate these risks, it is recommended to thoroughly test the beta version on a staging site before implementing it on a live site.

// Example code snippet to prevent users from accessing the site if it is running on a beta version of WordPress
function restrict_beta_version() {
    global $wp_version;

    if ( strpos( $wp_version, '-beta' ) !== false ) {
        wp_die( 'This site is currently running a beta version of WordPress. Please check back later.' );
    }
}
add_action( 'wp', 'restrict_beta_version' );