• Dysschord

    (@dysschord)


    I have tried some different combinations, but I’m a bit daft, apparently, with using the tags.

    I have a Menu item that I ONLY want to show to ONE specific user IF that user is logged in and IF that user is the Author of THE SPECIFIC POST the menu item is linking to. Say the Menu Item is called CANDY which is a post written by an author – and ONLY the author of the post CANDY can see the menu item to even click on it to see the post.

    I have tried is_user_logged_in() and is_author(’12’) but this doesn’t work, probably because it isn’t linking to an author page.

    Is there a way to accomplish this? Again, I want ONLY the logged in author of a particular post to see the menu item and be able to click it to see the post.

    https://wordpress.org/plugins/menu-items-visibility-control/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Dysschord

    (@dysschord)

    I’m sorry, guess I’d better clarify, I need the code for the Visibility field IN the menu item. I have no idea what loops are or how to program.

    Plugin Author shazdeh

    (@shazdeh)

    Hi!
    You would need to use get_current_user_id to get the ID of the current logged-in user (the is_author is a Conditional Tag that checks for author archive pages). So something like this:

    is_user_logged_in() && 12 == get_current_user_id()

    Would check if the current user is the one with the ID of 12.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show menu item ONLY to specific user’ is closed to new replies.