close
Skip to content

Navigation Link: Add showForLoggedInOnly attribute for visibility#70659

Closed
prasadkarmalkar wants to merge 2 commits intoWordPress:trunkfrom
prasadkarmalkar:feat/issue-70605
Closed

Navigation Link: Add showForLoggedInOnly attribute for visibility#70659
prasadkarmalkar wants to merge 2 commits intoWordPress:trunkfrom
prasadkarmalkar:feat/issue-70605

Conversation

@prasadkarmalkar
Copy link
Copy Markdown
Contributor

What?

Closes #70605

Add a checkbox to show the navigation link to only logged in user.

Why?

Currently, there is no built-in way to add conditions to menus, such as displaying different menu items when a user is logged in or logged out.

How?

  • Created a checkbox option in navigation-link and set a attribute
  • While dynamically rendering menu check attribute and display only if its set and user is logged in

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

Screen.Recording.2025-07-09.at.1.12.30.PM.mov
Before After
Screenshot 2025-07-09 at 1 14 37 PM Screenshot 2025-07-09 at 1 15 41 PM

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 9, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: prasadkarmalkar <prasadkarmalkar@git.wordpress.org>
Co-authored-by: jartes <jartes@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@shail-mehta shail-mehta added [Type] Enhancement A suggestion for improvement. [Block] Navigation Affects the Navigation Block labels Jul 9, 2025
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prasadkarmalkar Sorry for the late reply.

In fact, we are working on hiding blocks based on screen size, and we may implement additional functionality in the future to conditionally render blocks. See #72502 (comment) for more details.

Given that, it may not be desirable to implement certain conditional rendering functions on certain blocks.

I'd like to close this issue, but thank you for your efforts!

@t-hamano t-hamano closed this Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Navigation Affects the Navigation Block [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add conditional options in menu items

3 participants