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
- How do I create a custom role capability?
- How to create an API for my plugin?
- How can I load a page template from a plugin?
- How to get Post ID with the Add Filter Function
- 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?
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- function triggered by “manage_users_custom_column” filter not working
- Allowing Custom Capability to Manage Plugin Options
- add_filter and remove_filter added before and after wp_query
- Some nav-menu filters do nothing
- Filter on the_content ignores shortcodes
- How to change wordpress post title?
- 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
- 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?
- multiple functions with same filter
- 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?
- How do I alter the comment form ‘allowed tags’ text in a plugin?
- WordPress after content Hook & external template part
- 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_posts() not working when accessing with a custom user role
- How To Change Logout Screen Title
- Check for template part, else filter content
- Adding rewrite rule dynamically
- 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
- 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
- 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 the post excerpt using post object?
- WordPress custom post type capabilities issue
- hook filter after the_content on a specific page
- Call to undefined function is_home() or any conditional tags
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- Unable to access custom plugin backend
- WP_NAV_MENU filter targets all menus
- Adding filter to the title without affecting the menu title
- How to validate inputs with filter in register_setting callback
- How to get changed post title in my custom plug-in which fires when ‘save_post’ is called?
- Adding tables to dashboard pages programmatically?
- Can I attach a plugin via my add_filter callback contents?
- apply_filters() and call_user_func() to define and call a function outside a class
- Limit get_next_post to posts from the same author
- Any way, hook to add content right before the “read more” link?
- Add custom parameter for custom user role
- How to give custom roles the capability to edit one Menu instead of every Menu
- Redirect theme directory to plugin theme directory
- login_message filter not working
- WordPress Dropdown image select
- Modify search form with plugin
- Single_template for a custom post type created from a plugin is returning an empty page
- get_comment_meta() for a filter hook in a plugin
- Which filter to use to pre-parse form elements, which are generated by plugin’s shortcode?
- Remove from a div by class name from post page if post author role is not administrator
- Custom signature appears twice on page
- Confusing $tag specification for apply_filters call, in core options.php code
- Adding admin for specific users
- New Users are saved with no role selected
- How to filter get_adjacent_post()?
- WordPress User Management Departmental Managers
- WordPress permalink setting
- post_results filter confused by pagination in sidebar and main section
- Plugin capabilities
- How do I replace title with my plugin?
- Apply Filters Causing a 500 Internal Server Error
- add_filter adds output in the head
- Apply function on all action hooks?
- Ninja Forms: Front-End Forms, Post ID?