permission.php
// Add custom role if not exists
Add custom role if not exists
Add custom role if not exists
public function register_role()
    {
        $role = get_option('local_role_exists');
        if( !$role ) {
            add_role(
                'local',
                __( 'Lokalanvändare' ),
                [
                    'read'                   => true,  
                    'edit_pages'             => true,
                    'read_page'              => true,
                    'publish_pages'          => true,
                    'edit_published_pages'   => true,
                    'delete_published_pages' => true,
                    'publish_pages'          => true,
                    'publish_pages'          => true,
                    'delete_page'            => true, 
                ]
            );
            update_option('local_role_exists', true);
        }
    }
public function register_role ( ) { $ role = get_option ( 'local_role_exists' ) ; if ( ! $ role ) { add_role ( 'local' , __ ( 'Lokalanvändare'  , [ 'read' => true , 'edit_pages' => true , 'read_page' => true , 'publish_pages' => true , 'edit_published_pages' => true , 'delete_published_pages' => true , 'publish_pages' => true , 'publish_pages' => true , 'delete_page' => true , ] ) ; update_option ( 'local_role_exists' , true ) ; } }
Add custom role if not exists
Add custom role if not exists