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 );
Related Posts:
- How to retain HTML5 Attributes on Markup
- Remove “minor-publishing” div from Publish admin metabox
- how to know if admin is in edit page or post [duplicate]
- Admin: very slow edit page caused by core meta query
- Editor Styles and Typekit
- Styling Shortcodes in Visual Editor
- WordPress admin screen very slow / timing out when editing or adding a new page/custom post
- How do I set up a webhook?
- Adding custom Javascript to the head tag in Admin
- Integrate post tags in Post Edit page with qTranslate
- Change post title during post saving process
- Custom taxonomy admin description
- user-new.php less detailed after WP3.1; how to revert?
- Disable HTML (Text) Tab in Post Editor
- How to restrict the editors from viewing/editing pages created by admin?
- How to set default editor tab
- Make the Status, Visibility, or Date fields opened by default in the Publish box
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- Editors change a permalink on an unpublished post, but only admins change a permalink on a post that has ever been published?
- Change default italic from to in admin editor
- WordPress 3.1’s admin bar disappears only leaving its 28 px padding (in ubuntu)!
- Hide post title input for all roles except admin
- Post editor is 89953px tall. How to fix?
- Function to add custom HTML into head in custom post-type list page
- Weird jquery problem when upgrade to WordPress 3.1
- Gutenberg UI has changed
- Can I retrieve Published changes when changes have been Saved but not Published in WordPress Semplice?
- Disabling “View” mentions from backend?
- TinyMCE buttons broken
- Background image in login showing in admin area
- WordPress 4.5 Inline Link Toolbar not working on custom wp_editor instance
- What Role to assign remote site developer?
- CSS Styles specific to Admin Sidebar not loading
- Best collection of code for your 'functions.php' file [closed]
- Organizing Code in your WordPress Theme's functions.php File?
- What are the standard admin CSS id/class tags?
- How to remove admin menu pages inserted by plugins?
- How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?
- Admin Ajax is returning 0
- Add custom column to Users admin panel
- wp_verify_nonce vs check_admin_referer
- Add a Separator to the Admin Menu?
- How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?
- Modal window from within WordPress admin
- Where in WP can I check history or log of updates of plugins etc?
- Adding a custom admin page
- How does admin-ajax.php work?
- How to remove entire admin menu?
- How do I remove dashboard access from specific user roles?
- How can I speed up my WP admin section?
- How to pass parameters to admin_notices?
- if admin is logged in
- Search posts by ID in admin
- How to Change the Default Home Page for the WordPress Dashboard?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Find out which moderator approved comment?
- The website cannot display the page
- How To Remove WordPress Version From The Admin Footer
- Sort pages in loop by admin’s page attributes order field?
- Edit “thank you for creating with WordPress” in version 3.3.1
- Hide other users’ posts in admin panel
- Gutenberg editor add a custom category as wrapper for custom blocks
- Set Default Admin Colour For All Users
- How to use more than 256MB of memory in the admin?
- How to display by default only published posts/pages in the admin area?
- WordPress admin stylesheet
- This CSS Stuffing Works, But Is This A Good Practice?
- Is it possible to create a WordPress tour? V3.3.1
- Securing Admin Accounts – Username Discovery
- is_admin() returns true when using admin-ajax.php from front end script
- How to save dismissable notice state in WP 4.2?
- How do I optimize a custom post type admin page with 25,000 posts?
- Settings API – adding setting fields dynamically?
- How to include own css on wordpress tinymce editor?
- Disable Media Uploads to non Admin Users
- How do I load a CSS style into WordPress admin area only?
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- Can an admin check passwords of registered users?
- How can I target WordPress 3.8 new interface MP6 with CSS?
- Notification that the admin is online
- Does wordpress create activity, update logs?
- sort child pages on admin
- How-to make the admin area mobile friendly [closed]
- Change admin bar to default:off
- How to remove list view from media library?
- How to disable the “Your site has updated to WordPress x.y.z” admin email?
- Load plugin scripts and styles only on plugin page
- Plugin to remove Admin menu items based on user role?
- How to obtain the user ID of the current profile being edited in WP-Admin?
- Add separator to admin submenu
- 3.3: How do you hide the new dashboard welcome panel?
- Add my own button next to “Screen options” and “Help” in the admin
- How to remove categories filter from wordpress admin?
- WP List Table custom quick edit box – post meta data missing and columns change on submit
- Settings API – easiest way of validating checkboxes?
- Are there any action like ‘init_frontend’
- What is the best way to customise admin files so they survive future upgrades?
- Should I use is_admin() inside ‘admin_init’ hook callback
- Custom admin email for new user registration
- Send Admin Emails to Multiple Email Addresses