Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Compatibilité de la fonction wp_open_body() pour tous les thèmes
add_action( 'get_header', 'baw_wp_body_open_buffer' );
function baw_wp_body_open_buffer() {
do_action( 'wp_body_open' );
$wp_body_open_content = ob_get_clean();
ob_start( function( $buffer ) use( $wp_body_open_content ) {
return preg_replace( '(<body.*>)', "$0\n$wp_body_open_content", $buffer );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment