• Users on our multisite install cannot save a page with form code without it getting stripped out. This used to be related to unfiltered_html but that is checked in deprecated options. What else needs to be checked to prevent this from happening to users so they can post form code? Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Vladimir Garagulya

    (@shinephp)

    WordPress multisite blocks unfiltered_html capability by default as potentially vulnerable.
    So you have to use custom code to change this, like below:

    
    add_filter('map_meta_cap', 'allow_unfiltered_html', 10, 2);
    
    function allow_unfiltered_html( $caps, $cap='' ) {
            
            if ( $cap==='unfiltered_html' || $cap==='edit_css' ) {
                $current_user = wp_get_current_user();
                if ( isset( $current_user->allcaps['unfiltered_html'] ) && 
                    $current_user->allcaps['unfiltered_html'] && $caps[0]=='do_not_allow') {
                    $caps[0] = 'unfiltered_html';
                    return $caps;
                }        
            }
    
            return $caps;
    
        }
        // end of allow_unfiltered_html()
    

    Add code to the active theme functions.php or install as a Must Use plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘Users html is stripped out’ is closed to new replies.