Support » Plugin: Nav Menu Roles » How can I get unpublished pages visible in the menu for privileged user roles?

  • Resolved abitofmind

    (@abitofmind)


    My question does not concern your concrete plugin, but is rather an idea for a new standalone plugin.

    I ask you because this feature idea is very closely related to the subject domain of your plugin and you likely know which WordPress Core behavior needs to be altered to achieve the desired outcome.

    I wonder why this obviously desire-able workflow did yet not make it into WordPress? Privileged roles (Admin, Editor) can get the full experience of the website ahead of time — that is they see page content AND also how that new content will fit into the menu (important part of the UX!) — whereas disallowed users and web spiders see neither.

    So I would like to only manage the post-status of pages, which the WordPress workflow anyhow enforces upon you. And would like the visibility of their corresponding menu items follow acordingly. Just with a slightly tweaked behavior: Unpublished pages ARE visible in the menu to legitimated user roles. In a MVP this would be hardcoded to Admin + Editor.

    In v2 there could be some customization settings:

    Menu items corresponding to:

    • Post types: ☑︎ Pages ☑︎ Posts ☑︎ Products ☑︎ CustomType
    • of status: ☑︎ Draft ☑︎ Pending ☑︎ Future ☑︎ Private
    • are visible to: ☑︎ Admin ☑︎ Editor ☑︎ Contributor ☑︎ Subscriber

    Denote Post Status in Menu Item and/or Page Title like this:

    Post Status | Menu Title        | Page Title               |
    ------------------------------------------------------------
    
    Draft       | [ Prefix ▾ ] : 📎 | [ Suffix ▾ ] : (Draft)    |
    Pending     | [ Prefix ▾ ] : ⏳ | [ Suffix ▾ ] : (Pending)  |
    Future      | [ Prefix ▾ ] : 🗓 | [ Suffix ▾ ] : (Upcoming) |
    Private     | [ Prefix ▾ ] : 🔒 | [ Suffix ▾ ] : (VIP)      |

    Remarks on the feature extensions over time:

    v2: E.g. you don’ want “Draft” pages in order to have less “noise” in the menu, but want the other statuses there. And you want to customize how the status is denoted. Currently that’s hardcoded for Post Titles. And for menu status is not denoted, that would be something new too.

    v3: Rule groups: Add new rule, select roles in that group, select which post types of what status they shall see.

    • This topic was modified 10 months, 2 weeks ago by abitofmind.
    • This topic was modified 10 months, 2 weeks ago by abitofmind.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author HelgaTheViking

    (@helgatheviking)

    Sorry, I don’t have any suggestions for you. My plugin adds extra fields to existing nav menu items, but has no control over how WordPress decides to display pages as possible items or not.

    Thread Starter abitofmind

    (@abitofmind)

    I found https://wordpress.org/support/topic/code-to-show-private-pages-on-menu-screen-not-working/ but its description

    to make private pages show up in the Appearance → Menu screen so the user can add private pages to a menu

    lets me assume the code stated there only has relevance for the Backend.

    But I would need to know how to alter the code that makes the decision in the front end regarding which post-statuses make corresponding menu items shown or hidden.

    Could you have a short look whether the code of the linked thread has only backend relevance or potentially also frontend relevance.

    Also do you know from where the (seemingly) hard-coded prefixes “Private: “, “Draft: ” etc come from? Which in my v2 of the proposed plugin one could alter (in post title and menu label).

    Thread Starter abitofmind

    (@abitofmind)

    WOULD PREFER WORDPRESS TO BETTER SUPPORT THESE KIND OF SCENARIOS:

    Website as it shall be (superset) internally fully accessible with content in different stages of readiness but all represented in menu/navigation as planned vs. Published website only featuring content ready for public consumption + corresponding menu. And in all this efficiently move content from the superset (private) to the subset (public). Hence the idea for the simple behavioral tweak as an option for those needing it.

    WORKAROUND FOR NOW: WORK WITH A STAGING & PRODUCTION SERVER FOR THIS PURPOSE.

    Production Server:

    • Menu contains only published pages, corresponding to published pages, which content wise are indeed ready.

    Staging server:

    • All pages are in status “published” although in reality:
    • e) Some of them are empty, serving as a placeholder for planned content/hierarchy
    • d) Some of them are drafts or already pending review
    • p) Some are ready for publication
    • Before pushing to production I change the status to their real status. Then I see the reduced menu, holding only content ready for publication.
    • Then I push to stage.
    • All content editing is done entirely on staging, so wp_posts is always cleanly overwritten from stage to production, and no merge conflicts ever arise.

    Outlook

    • When my website “has less wholes” I can finally kiss that cumbersome workflow goodbye and add content on a bit by bit basis. For this the existing workflow is made fine (origins of WordPress as a pure blogging software).
    • But for larger projects, which have a large percentage of placeholders or half-ready content in their early stage, the current workflow really does not support this reality of content creation at all. My optional behavioral tweak would support these type of scenarios better.
    • This reply was modified 10 months, 2 weeks ago by abitofmind.
    Thread Starter abitofmind

    (@abitofmind)

    Came to an important realization:

    Realized that in WordPress Backend → Appearance → Menu ( provided by WP Core at /wp-admin/nav-menus.php) you cannot add a page to a menu unless it’s published.

    Placing unpublished pages as menu items is only made possible with the plugin Nested Pages which I actively use on my website.

    Hence my feature request must be towards Nested Pages!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can I get unpublished pages visible in the menu for privileged user roles?’ is closed to new replies.