It is enough to add unfiltered_html
capability to Editor
role.
Add the following code into your current theme’s functions.php
:
function wpse_change_capability() {
$role = get_role( 'editor' );
if ( ! $role->has_cap( 'unfiltered_html' ) )
$role->add_cap( 'unfiltered_html' );
}
add_action( 'init', 'wpse_change_capability', 10 );
Login as the user with Editor
role. Test it by editing any post / page. HTML markup will be preserved. Remove the code above from functions.php
.
If you decide to remove unfiltered_html
capability from Editor
role, repeat steps described above, using this code:
function wpse_change_capability() {
$role = get_role( 'editor' );
if ( $role->has_cap( 'unfiltered_html' ) )
$role->remove_cap( 'unfiltered_html' );
}
add_action( 'init', 'wpse_change_capability', 10 );