Changes to wp_die() HTML output in WordPress 5.3

By default and before WordPress 5.3, the handler for wp_die() wraps error messages with a paragraph tag.

For a number of wp_die() calls in WordPress, a plain text string is passed and the HTML displayed is valid: 

wp_die( 'This is an error message.' );

Currently returns:

<p>This is an error message.</p>.

However, for a number of other wp_die() calls, the HTML displayed is invalid because paragraphs doesn’t allow every nesting possibilities.

For example:

wp_die( '<h1>You need a higher level of permission.</h1><p>Sorry, you are not allowed to manage terms in this taxonomy.</p>' );

Currently returns:

<p><h1>You need a higher level of permission.</h1><p>Sorry, you are not allowed to manage terms in this taxonomy.</p></p>

With WordPress 5.3, error messages are wrapped in a <div> rather than a <p>, to better support string calls in wp_die(), without
outputting invalid HTML.

These changes also add .wp-die-message CSS class for styling.

For example:

wp_die( '<h1>You need a higher level of permission.</h1><p>Sorry, you are not allowed to manage terms in this taxonomy.</p>' );

Will now return:

<div class="wp-die-message">
    <h1>You need a higher level of permission.</h1>
    <p>Sorry, you are not allowed to manage terms in this taxonomy.</p>
</div>

Plugin authors are encouraged to check their use of wp_die() and update their PHP calls to the function or their CSS styles if needed.

For reference, see Trac ticket #47580.

#5-3, #dev-notes