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
- Add a Separator to the Admin Menu?
- Adding a custom admin page
- Allowing admin-ajax.php to receive “application/json” instead of “x-www-form-urlencoded”
- What is the best way to customise admin files so they survive future upgrades?
- Custom admin email for new user registration
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- localhost/wp-admin on my local redirects to production site’s /wp-admin
- Hide allow trackbacks/pingbacks
- How to build custom WP admin with custom URLs
- Add Admin User via SQL
- Add number new posts (post_status = pending) to administration menu [duplicate]
- How to remove Gravatar from Username column
- Page only shows when user is logged in (even with visibility set to public)
- get_template_part in admin
- Why Jetpack is missing the “Feedbacks” menu item? [closed]
- Getting the different post statuses + count like in edit.php, in a custom submenu page
- What is the optimal way to filter out subpages from admin?
- Create a Meta Box in the Admin User Screen?
- Send email to Admin when user/member updates specific user/member data
- Help with shortcode in admin-ajax [closed]
- How can I allow a custom taxonomy for certain roles?
- Protect custom php file with login
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- Remove the whole menu in the admin
- disable admin-bar search field for specific roles
- Change top level menu item to point to custom submenu item
- Change admin logout URL
- Link to post author but exclude administrator (on single.php)
- Default admin color scheme as “blue”
- Don’t attribute content to admin users
- Can user #1 (the initial user) be deleted without ill effect?
- wp-admin post.php JavaScript Links Not Working
- Remove duplicate product link from WooCommerce Page Row Actions
- Admin Taxonomy Terms – Orderby Term Field
- Change the Labels of Users to Customers in Admin
- Attachment display settings only allows “full-size”
- Add ALT attribute to Pin It Button image to pass HTML5 validation
- Admin option sidebar count
- Admin search post meta
- Admin Top Bar Not Showing On Front End
- WordPress administration Over SSL – To Force SSL Logins and SSL Admin Access
- Only Admin can Edit, Delete or Update
- Set Edit Post meta boxes inactive
- How to verify nonces in bulk?
- Getting admin notices to appear after page refresh
- WordPress Hacked 5.5 admin-ajax.php [closed]
- How to start editing my site with WordPress?
- Excerpt showing under title in admin columns
- how to remove +new from wp admin area
- html id is removed for non admin user?
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- Dynamic WordPress Admin Panel
- How to show a custom notification to a specific user?
- Control Users listed in Users List on dashboard
- my wordpress configuration locally vs live server
- Why does my admin email address keep changing to something random?
- WordPress Admin Doesnt work
- Adding more than one WordPress Gutenburg block type?
- WP administration over SSL using different domain
- Hide top admin panel for non admin and non editors
- Is it possible to create a custom admin page for users?
- Downloading file from wp-admin folder
- Custom styles and scripts for specific admin screen
- Add Sort Link in Custom Post Type List
- local WAMP admin user has lost privileges
- Create users via PHP
- Display notice in block editor after wp_insert_post_data hook