Make WordPress Core

Opened 12 years ago

Last modified 6 years ago

#21773 new defect (bug)

Scheduled pages/posts should not appear in custom menus

Reported by: lorangeo's profile Lorangeo Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: needs-testing has-patch reporter-feedback
Focuses: Cc:

Description

When I add a scheduled page/post in a custom menu the page/post immediately appears in the front-end menu.

I think these scheduled pages/posts should only be visible in the front-end navigation when their scheduled time is reached (as it is the case with automatic menus). Otherwise the "Schedule" functionality makes no sense with custom menus, especially for pages.

Here is another forum post regarding this issue: http://wordpress.org/support/topic/custom-menu-support-for-scheduled-pagesposts

Attachments (1)

21773.diff (1.4 KB) - added by dkotter 9 years ago.

Download all attachments as: .zip

Change History (13)

#1 @SergeyBiryukov
12 years ago

  • Component changed from General to Menus

#2 @ericlewis
12 years ago

  • Keywords reporter-feedback added

Could not replicate the bug on trunk with twentyeleven.

If no custom menu has been created, the default menu uses the function wp_page_menu, which via wp_list_pages get_pages queries only for pages that have a post status of 'publish', while any scheduled pages would have the post status of 'future.'

Last edited 12 years ago by ericlewis (previous) (diff)

#3 @Lorangeo
12 years ago

  • Keywords reporter-feedback removed

The default menu (which is automatically generated) is OK. The problem is with custom menus.

It should be possible to create a custom menu, add some scheduled pages to it, and expect that these scheduled pages will only appear in the front-end menu when their scheduled time is reached.

Sorry if I'm not clear but my English is somewhat limited.

#4 @c3mdigital
12 years ago

  • Type changed from defect (bug) to enhancement
  • Version set to 3.0

#5 @jdcohan
12 years ago

Related:

Private and Draft pages also appear (to all users, including non-logged-in) in a Primary Navigation menu which is based on a Custom Menu. My most recent confirmed test was with WordPress 3.4.2 and Twenty Ten 1.4.

Seems to me this is a defect. I'm just saying...

#6 @Lorangeo
12 years ago

  • Type changed from enhancement to defect (bug)

jdcohan is right. Pages set as "Private" or "Draft" still appear in custom menus, even for users that are not logged in and that should not be aware of these contents.

From the WP codex:

Private content is published only for your eyes, or the eyes of only those with authorization permission levels to see private content. Normal users and visitors will not be aware of private content.

Based on this I would also consider it a defect that hopefully shouldn't be too difficult to fix.

#7 @alexfurr
11 years ago

hi - this still seems to be a problem i.e. scheduled pages should NOT appear in a custom menu.
Any movement on this? I would imagine its quite a simple fix :) (he says!)

kind regards,

Alex

#8 @helen
11 years ago

Related: #24975

#10 @chriscct7
9 years ago

  • Keywords needs-patch needs-testing added

@dkotter
9 years ago

#11 @dkotter
9 years ago

  • Keywords has-patch added; needs-patch removed

Added a patch that makes sure any menu items that are of the type post_type (so posts, pages, CPTs) don't show on the front-end if they don't have the publish status. So this will remove scheduled items, draft items and private items from showing up.

I wasn't sure on the best place to put this, as there is a _is_valid_nav_menu_item function that I thought maybe extending to include this functionality might make sense, but ultimately I just created a similar function to handle this.

I have tested this and it seems to work great, but am open to any ideas if there's a better way to approach this or better place to put this.

#12 @welcher
8 years ago

  • Keywords reporter-feedback added

This very similar to 33742. Can we confirm this wasn't fixed along with that?

Note: See TracTickets for help on using tickets.