Support » Plugin: Menu Item Visibility Control » Main manu entry doesn’t desappear from sight

  • Hi,
    I am trying to hide one of main menu entries (The ‘Case study” menu), but when I use
    in_array( ‘administrator’, $GLOBALS[‘current_user’]->roles ) the menu entry is still there but if I click o nit or hover over it this just greys out and I can’t reach the page (which is good but not the intended behaviour). If I use ! is_home(), same behaviour happens, same as if I use in_array(‘administrator’, $GLOBALS[‘current_user’]->roles).

    What clause should I use in order to hide a main menu item?
    Regards

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Hi!
    I see the menu item you’re referring to. Can you please go to Appearance > Menus and open that menu item, then take a screenshot and share it here?

    Hi
    don’t know how to include/attach the image here….can you help?

    Plugin Author shazdeh

    (@shazdeh)

    You can upload to imgur.com and paste the link here.

    Plugin Author shazdeh

    (@shazdeh)

    I see you’re using is_home(), note that with the way WP works, that function does not check whether visitor is on the homepage (it’s a bit weird, see: https://codex.wordpress.org/Creating_a_Static_Front_Page). If you want to check if it’s homepage you have to use:

    
    is_home() || is_front_page()
    

    Or, if they’re not on homepage:

    
    ! ( is_home() || is_front_page() )
    

    Ok, I see. So if I need to hide that menu entry always, what should use?

    When I use is_home() || is_front_page() and I am on the home page I can still see the menu entry. The only effect that I can appreciate is that one cannot click on it and enter the corresponding page and that it fades away a little bit.

    When I substitute !(is_home() || is_front_page()) I receive a message saying: “The link you followed has expired.”

    Plugin Author shazdeh

    (@shazdeh)

    If you want to permanently disable the menu item you can simply use:

    
    false
    

    As the condition, and the menu item will not be displayed.
    If the above conditions are not working, the likely cause of the issue would be theme conflict. You can momentarily switch to a different theme, activate your menus and check if the conditions are working. In that case, there’s a conflict with the theme; however seeing as you’re using a premium theme I don’t have access to, would you be willing to give me access to your WP administration dashboard so I could check? My address is: hassanderakhshandeh, using Gmail.

    Hi, if I use the ‘false’ condition in just one of main menu entries the whole main menu bar desappears!

    What do you mean by theme conflict?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Main manu entry doesn’t desappear from sight’ is closed to new replies.