• Resolved 3Pinter

    (@3pinter)


    So basicly if a user is author or lower there is no need for them to have the editor.

    Im using the latest version of WP in a multisite environment.

    I have a function that states all the unneeded stuff, which I will hook into WP the correct way. So far so good.

    function dio_removals() {
    		if ( !current_user_can('manage_links') ) {
    		// remove post types
    		remove_post_type_support( 'post', 'editor' );
    		// remove meta WP version
    		}
    		remove_action('wp_head', 'wp_generator');
    	}

    manage_links is something an author-role isn’t allowed to do so I thought this should work. But it doesn’t. As a superadmin I don’t have the editor either now.

    What goes wrong / what should I do?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could do it by actually checking the current users role by so:

    add_action( 'admin_init', 'dio_removals' );
    
    function dio_removals() {
    	$current_user = wp_get_current_user();
    	if ( in_array( 'author', $current_user->roles ) ) {
    		// remove post types
    		remove_post_type_support( 'post', 'editor' );
    		// remove meta WP version
    		remove_action('wp_head', 'wp_generator');
    	}
    }

    Thread Starter 3Pinter

    (@3pinter)

    Ah nice. That works.

    Much appreciated. Ty.

    Thread Starter 3Pinter

    (@3pinter)

    resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘remove editor option for userrole author (and lower)’ is closed to new replies.