PHP if (item) = almost equal to (item2)

Viewed 31

I am working on a Wordpress plugin that needs to make menu items (in wp-admin) invisible for specified roles. But i have a bug where you cannot see the menu item but if you type the URL you will still go to that menu item. I created a function that checks if statement if the user has that special roll. otherwise it wil go to the else. The disabled menu items are all in a Array the array output looks something like this: [0] => edit.php [1] => tools.php (because messages and tools are disabled) this array is called $LinkToGo

$url = "https://website.com/wp-admin/edit.php";

if ($url === $LinkToGo)
{
    echo "<script type='text/javascript'>alert('contineu');</script>";
}else{
     echo "<script type='text/javascript'>alert('cancel');</script>";
}

now i need to check if $LinkToGo has 'edit.php' in this case, otherwise it needs to go to the else statement. I am really stuck with a fried brain on this question

0 Answers
Related