how to allow users to put html on multisite

how i can allow SOME of users to put html to sites on my network? i realise that they cant put iframe html to site, but how i can make it possible only for some users that i select, but to dont make them superadmins?

  • Vaughan

    Hi Nikola,

    Hope you're well?

    Most users can post HTML, but there's only a very basic set of tags they can use, do you mean unfiltered RAW HTML?

    For this you would need to edit the capabilities or roles.

    If it's just a specific number of users, then It would be best creating a new Administrator role for them, for example

    create a role called special admin

    Then give that role all the same capabilities as administrators, but with 1 exception, you also give them the capability of unfiltered_html

    the easiest way to do this is with User role editor or Press permit plugins (you will need the pro version though for editing administrator roles)

    https://wordpress.org/plugins/press-permit-core/

    https://wordpress.org/plugins/user-role-editor/

    Hope this helps

  • Vaughan

    Hi nikola,

    You could perhaps use a mu-plugin for this with some custom code in.

    I have wrote a function for you, but haven't tested it.

    Create a file called custom_roles.php

    Now add the following code to this file;

    <?php
    function add_custom_admin_role() {
    
        $result = add_role(
            'custom_administrator',
            __( 'Custom Administrator' ),
            array(
                'read'         => true,
                'edit_posts'   => true,
                'delete_posts' => true,
                'activate_plugins' => true,
                'delete_others_pages' => true,
                'delete_others_posts' => true,
                'delete_pages' => true,
                'delete_posts' => true,
                'delete_private_pages' => true,
                'delete_private_posts' => true,
                'delete_published_pages' => true,
                'delete_published_posts' => true,
                'edit_dashboard' => true,
                'edit_others_pages' => true,
                'edit_others_posts' => true,
                'edit_pages' => true,
                'edit_posts' => true,
                'edit_private_pages' => true,
                'edit_private_posts' => true,
                'edit_published_pages' => true,
                'edit_published_posts' => true,
                'edit_theme_options' => true,
                'export' => true,
                'import' => true,
                'list_users' => true,
                'manage_categories' => true,
                'manage_links' => true,
                'manage_options' => true,
                'moderate_comments' => true,
                'promote_users' => true,
                'publish_pages' => true,
                'publish_posts' => true,
                'read_private_pages' => true,
                'read_private_posts' => true,
                'read' => true,
                'remove_users' => true,
                'switch_themes' => true,
                'upload_files' => true,
                'unfiltered_html' => true,
            )
        );
    }
    do_action('init', 'add_custom_admin_role');

    Now copy this file to your /wp-content/mu-plugins folder using FTP

    If mu-plugins does not exist, create it first.

    Now visit the front-end of your site & hit refresh.

    You should now be able to see a new role called Custom Administrator

    So all you have to do now is edit each user you want to use this role, and then select this new custom role.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.