Support

Account

Home Forums General Issues Custom role can't save HTML into TextArea field

Helping

Custom role can't save HTML into TextArea field

  • I have a custom role called “Members”, with the following post_type/caps settings

    function register_memberspt() {
        $labels = array(
            'name'                  => _x( 'Members', 'Post type general name', 'textdomain' ),
            'singular_name'         => _x( 'Member', 'Post type singular name', 'textdomain' ),
        );
     
        $args = array(
            'labels'             => $labels,
            'public'             => true,
            'publicly_queryable' => true,
            'show_ui'            => true,
            'show_in_menu'       => true,
            'query_var'          => true,
            'rewrite'            => array( 'slug' => 'members' ),
            'capability_type'    => 'post',
            'has_archive'        => true,
            'hierarchical'       => false,
            'menu_position'      => 5,
            'menu_icon'         =>  'dashicons-groups',
            'supports'           => array( 'title', 'editor', 'author', 'thumbnail' ),
        );
     
        register_post_type( 'memberspt', $args );
    }
    
        add_role('member', _('Member'), [
            'upload_files' => true,
            'publish_posts' => true,
            'edit_published_posts' => true,
            'delete_published_posts' => true,
            'edit_posts' => true,
            'delete_posts' => true,
            'read' => true,
            'publish_pages' => true,
            'edit_pages' => true,
            'edit_published_pages' => true,
            'delete_pages' => true,
            'unfiltered_html' => true,
        ]);
    

    I have a TextArea field called location_map, that takes in <iframe> embed code, and outputs frontend. Everything works when I’m using an admin user.
    However, when updating with a user with the Member role, I am unable to update any HTML codes into the TextArea field.

    e.g.
    When I try to save <iframe ….></iframe>, it just disappears.
    When I try to save <iframe …></iframe> asd, only “asd” remains.

    Any help would be much appreciated

  • Additionally, seems like every other html code works. <div>, <p> etc works. only <iframe> disappears.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.