Make WordPress Core

Opened 8 years ago

Last modified 3 weeks ago

#40178 new enhancement

Menus that contain post types in Draft status should be hidden from logged out users

Reported by: jdingman's profile jdingman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.3
Component: General Keywords: has-patch 2nd-opinion needs-testing
Focuses: ui, administration Cc:

Description

I recently added 2 pages to my site. I published them, and moved them into a Menu on my site.

Then realized, I don't want them public, but I also don't want to lose their positioning where I put them in the menu. I moved them to draft.

When I go to my site logged out, I still see the links and goes to a 404.

I'm proposing that when an item in the Menu moves to a non-published state that isn't the Trash (Draft or Pending), it should remain in the nav, but be hidden from any logged out users.

Attachments (4)

40178.diff (913 bytes) - added by bor0 8 years ago.
WP Admin Menus.png (32.5 KB) - added by lukecavanagh 8 years ago.
WP Admin Menus
40178.patch (4.7 KB) - added by desrosj 8 years ago.
40178.2.patch (3.7 KB) - added by desrosj 8 years ago.
Replaces space indentation with tabs. Still configuring new editor.

Download all attachments as: .zip

Change History (9)

#1 @bor0
8 years ago

I was able to reproduce this and I agree that it is a bug. Non-published pages do not appear on the dropdown list in Appearance > Menus. However, when once added to a menu, they will appear in the Menu Structure in wp-admin regardless of their publish status.

After proposed patch, unpublished items will appear as such "Name (Invalid)" on the wp-admin part.

@bor0
8 years ago

#2 @bor0
8 years ago

  • Keywords has-patch added

@lukecavanagh
8 years ago

WP Admin Menus

#3 @lukecavanagh
8 years ago

@bor0

Patch applies cleanly and works as expected.

@desrosj
8 years ago

#4 @desrosj
8 years ago

  • Keywords 2nd-opinion needs-testing added

I think that it would be better not to declare draft content in the menu as "invalid".

I added a new patch that shows draft items as orange with a new warning. They are then filtered out the same way as invalid items, but with a new filter function checking that the content is published.

Customizer support for this approach needs to be added.

@desrosj
8 years ago

Replaces space indentation with tabs. Still configuring new editor.

#5 @avinashbhosale
3 weeks ago

Reproduction Report

Description

This report validates that the issue cannot be reproduced.

Environment

  • WordPress: 6.8.1
  • PHP: 8.2.27
  • Server: nginx/1.26.1
  • Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.2.27)
  • Browser: Chrome 137.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins: None activated
  • Plugins:
    • Admin and Site Enhancements (ASE) 7.8.12
    • Site Kit by Google 1.153.0
    • Test Reports 1.2.0
    • WP Consent API 1.0.8

Actual Results

  1. ❌ Error condition does not occurs (not reproduced).

Additional Notes

  • I created a menu with 3 page links added to it, changed the status of the 2 pages in the menu to draft/pending review. The menu does not show the page links for the pages saved as draft or pending review. The page links are not displayed in the menu to the logged out users as well.
Note: See TracTickets for help on using tickets.