Remove items on dashboard back end

Hi, I’need to remove icon Menu for access to Cornestone to specific user. First rember I used these code with custom function. These old code works fine to the new relase? There’s another mode to remove “view” and “access” to pro and cornestone menu for specific user?

 $user_ID = get_current_user_id(); 
	if ($user_ID != 0) {
	//remove menu
		function r_m(){
			remove_menu_page('x-addons-home');
		}
	add_action( 'admin_menu', 'r_m', 999);
	
	//remove theme pro
	add_filter( 'wp_prepare_themes_for_js', 'ht');
	function ht($arr){
		unset($arr["pro"]);
	return $arr;
	}
	//remove toolbar pro
	function r_tbm() {
		global $wp_admin_bar;
		$wp_admin_bar->remove_menu('tco-main');
	}
	add_action('wp_before_admin_bar_render', 'r_tbm', 999); 
	
	//remove editor list page
	function r_ep() {
		echo '<style>
		.cs-editor-container, 
		.edit_cornerstone,
		.edit-post-header__toolbar .components-button.is-primary.is-button {display: none;}
		tr[data-slug="custom-functions-by-xonet"] {display:none;}
		tr[data-slug="custom-404"] {display:none;}
		tr[data-slug="insert-headers-and-footers"] {display:none;}
		tr[data-slug="snippet"] {display:none;}
		tr[data-slug="under-construction"] {display:none;}
		tr[data-slug="white-label"] {display:none;}
		</style>';
	}
	add_action('wp_head', 'r_ep');
	add_action('admin_head', 'r_ep');	
}

	$user_ID = get_current_user_id(); 
	if ($user_ID != 1) { function r_m(){ remove_menu_page('x-addons-home');} add_action( 'admin_menu', 'r_m', 999);
	add_filter( 'wp_prepare_themes_for_js', 'ht'); function ht($arr){ unset($arr["pro"]); return $arr;}
	function r_tbm() { global $wp_admin_bar; $wp_admin_bar->remove_menu('tco-main');}
	add_action('wp_before_admin_bar_render', 'r_tbm', 999); function r_ep() { echo '<style> 
	.cs-editor-container, .edit_cornerstone, .edit-post-header__toolbar 
	.components-button.is-primary.is-button { display: none;}
	tr[data-slug="custom-functions-by-xonet"] {display:none;}
	tr[data-slug="custom-404"] {display:none;}
	tr[data-slug="insert-headers-and-footers"] {display:none;}
	tr[data-slug="snippet"] {display:none;}
	tr[data-slug="under-construction"] {display:none;}
	tr[data-slug="white-label"] {display:none;}</style>';}
	add_action('wp_head', 'r_ep');
	add_action('admin_head', 'r_ep');}

Hello @ICTn,

Thanks for writing in!

Be advised that custom PHP coding is beyond the scope of our support under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

We highly recommend that you consult the source of this code to confirm that the code above still works with the latest version of the theme.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.