<?php
/**
* Add the unfiltered_html capability to the editor role.
* Be careful which users you grant this capability to.
*/
add_filter( 'map_meta_cap', function ( $caps, $cap, $user_id ) {
// Change editor with the user role you want to allow to use unfiltered_html.
if ( 'unfiltered_html' === $cap && user_can( $user_id, 'editor' ) ) {
$caps = array( 'unfiltered_html' );
}
return $caps;
}, 1, 3 );