Bug with map_meta_cap filter | WordPress.org

[ad_1]

Hi, I’ve found some compatibility issues – there are cases where the security plugin wipes out admin menus and breaks capability checks.

In some cases the map_meta_cap filter’s 2nd parameter $cap evaluates to true, so because the following code in the Editors Service does not do a strict comparison the condition will pass:


public function disable_file_edit( $caps, $cap ) {
	if ( in_array( $cap, array( 'edit_themes', 'edit_plugins', 'edit_files' ) ) ) {
		return array( 'sg-security' );
	}

	return $caps;
}

The in_array() function should use the 3rd argument as true so it does a strict comparison rather than a loose one.

Cheers!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer