<?php

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

if ( ! $errors ) return;
?>

<?php ob_start(); ?>
<ul>
    <?php foreach ( $errors as $error ) : ?>
        <li><?php echo wp_kses_post( $error ); ?></li>
    <?php endforeach; ?>
</ul>
<?php theme_error_message(ob_get_clean()); ?>