This had me baffled for a while as well. Not exactly a solution for your problem, but this should get you on your way.
add_action( 'admin_init', 'my_kses_remove_filters' );
function my_kses_remove_filters() {
$current_user = wp_get_current_user();
if ( my_user_has_role( 'administrator', $current_user ) )
kses_remove_filters();
}
function my_user_has_role( $role="", $user = null ) {
$user = $user ? new WP_User( $user ) : wp_get_current_user();
if ( empty( $user->roles ) )
return;
if ( in_array( $role, $user->roles ) )
return true;
return;
}
This action removes the filters for administrators. First it gets the role of the current user and if the role is ‘administrator’, it removes the filters on editing content.
This solutions draws heavily from this page.
Related Posts:
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to Structure a New Role/Capability Scheme?
- Limit role to one plugin [duplicate]
- Logout users upon login, based on caps/role?
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- How to determine which capability to use?
- Allow contributor user role to perform copy operation PHP
- Buddy Press restrict the capability to edit users
- What is more secure checking capabilities of user or checking role of user in WordPress plugin development
- Difference Between Filter and Action Hooks?
- How do I create a custom role capability?
- How to create an API for my plugin?
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- How can I load a page template from a plugin?
- Send user activation email when programmatically creating user
- Change default admin page for specific role(s)
- Using query_vars filter
- How to Change the Entire WordPress Admin panel Look and Feel?
- How to get Post ID with the Add Filter Function
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- How do you use the plugin boilerplate loader class to hook actions and filters?
- add_filter OO with parameters
- How Can I Add a Filter to Class Instance Only?
- Is it possible to remove next-post / previous-post with out creating a custom template?
- How do I Make a Theme “plugin-ready”?
- WordPress Capabilities: edit_user vs edit_users
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- function triggered by “manage_users_custom_column” filter not working
- Proper way to use apply_filters() with class functions?
- Allowing Custom Capability to Manage Plugin Options
- add_filter and remove_filter added before and after wp_query
- How to modify post content before writing to database?
- Actions or filters fired when data is saved in a custom table
- Some nav-menu filters do nothing
- Filter on the_content ignores shortcodes
- Determine which theme location a wp_get_nav_menu_items is for
- How to change wordpress post title?
- Display only certain posts based on visitor’s country?
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Conditional add_filter?
- Is it possible to create an action hook using do_action() within add_action()?
- How to add more than 1 user role to sub-menu pages
- Hook for post permalink update
- Dynamically Override Fancy Title
- Calling apply_filters on non-documented hooks
- Odd behaviour with submenu link creation
- WordPress Media mime type filter problem 4.0
- How to add custom content under plugin row in WordPress admin plugin list?
- Changing bloginfo description from a plugin
- Is there a way to verified if an add_filter is already applied?
- Define a function outside a class and call the function using action or filter hook
- Does add_filter work outside functions.php
- Synchronize Custom post type tags to WordPress default posts tags
- How to restrict plugin’s sub-menu pages to admin/subscribers?
- How to not let a user with a new role edit users that have administrator role?
- Execute plugin for specific user role(s) only
- multiple functions with same filter
- Woocommerce – Hide a Column in Cart Table
- Allow unfiltered HTML in titles for low level users?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- query users by role
- add_filter : Passing an array instead of the callback function?
- Hide plugin dashboard menu item for specific roles
- How do I alter the comment form ‘allowed tags’ text in a plugin?
- WordPress after content Hook & external template part
- Namespaced action and filter tags
- Two functions utilizing registration_errors filter
- Is there a Filter that I can use to filter the tags before they are inserted in to the database?
- WordPress is automatically linking plain text email addresses
- best practice for query string values – get_query_var always empty for my value supplied in query string
- get_current_screen() return null
- get_posts() not working when accessing with a custom user role
- Problems with: manage_${post_type}_posts_columns
- How To Change Logout Screen Title
- Add code inside specific wordpress standard function
- Check for template part, else filter content
- Why doesn’t my simple the_title filter get applied?
- How to filter the_content() & include content from template
- Adding rewrite rule dynamically
- Prefixing plugin hooks (actions/filters) with a wrapper class or functions
- Set different custom menu items for different user roles
- Replace youtube embed in wordpress
- Prevent third party plugin’s admin page access based on user type
- Can’t get woocommerce_get_price_html to work [closed]
- Search and Filter
- upload_files cap to not loggen in users – add_cap to not logged in users
- How can I replace content in the WP Admin area before an admin page is rendered?
- How to filter content for specific content variable
- You do not have sufficient permissions to access this page on a submenu
- WordPress custom taxonomy check box to dropdown
- wp_dropdown_roles() to replace option value = code
- Create a custom capability to allow an ‘Editor’ to edit only ‘Subscriber’ users
- Using ob_get_content to get_search_form puts into infinite loop
- Valid filenames for add_action’s first parameter
- How do I access the menus produced by Dashboard > Appearance > Menus
- WordPress class, using add_action to call member function does not work
- How to get all queries’s results after they have executed?
- How to get the post excerpt using post object?