• Hi I’m curious if there is a proper way of allowing unfiltered_html for a administrator user on multisite. Looking online it’s unclear if there is a current proper way of doing this that isn’t outdated/depreciated.

    I’m curious about this because I’m running into an issue with admin users getting logged out and I’m curious if the function below might be the cause because the issue started when I upgraded WordPress from 5.3.

    Here is the current way we do this via functions.php:

    function km_add_unfiltered_html_capability_to_admins( $caps, $cap, $user_id ) {
    	if ( 'unfiltered_html' === $cap && user_can( $user_id, 'administrator' ) ) {
    		$caps = array( 'unfiltered_html' );
    	}
    	return $caps;
    }
    add_filter( 'map_meta_cap', 'km_add_unfiltered_html_capability_to_admins', 1, 3 );

    As a note, I’m aware of the security threat this causes and while I wish I had a way to eliminate needing this, there currently isn’t a feasible way. On a weekly basis we need to embed multiple changing iframes from a third party. To help minimize risk, all admins require 2 factor.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unfiltered HTML’ is closed to new replies.