Opened 3 years ago
Last modified 3 years ago
#14551 new defect (bug)
menu item : current_page_parent : issue with Front page displays
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Menus | Version: | 3.0.1 |
| Severity: | normal | Keywords: | has-patch needs-testing gsoc |
| Cc: | wojtek.szkutnik@… |
Description
Settings > Reading > Front page displays: set to your latest posts
Settings > Reading > Posts page: set to anything
When the menus are building, they are only checking that something was set by the dropdown for posts page, even though the parent setting says the posts are to be on the home page. The pages on the site have the correct logic, however the menu adds "current_page_parent" to the item selected in the "Posts page" menu, even though it's not really the parent.
The work around is to just remember if you switch from having posts on a different page back to having them on the front, you need to set the "Posts page" back to "select" and everything works correctly, but getting users in my multi-site install to do that might be asking a bit much.
Attachments (1)
Change History (4)
comment:1
hughestm@… — 3 years ago
comment:2
hughestm@… — 3 years ago
Change to the two lines: need to remove (int) from get_option.
$front_page_displays = get_option( 'show_on_front' );
if($front_page_display == 'posts'){$home_page_id=0;}
wojtek.szkutnik — 3 years ago
comment:3
wojtek.szkutnik — 3 years ago
- Cc wojtek.szkutnik@… added
- Keywords has-patch needs-testing gsoc added; current_page_parent, menu, posts on page removed

Possible solution:
File: wp-includes/nav-menu-template.php
Add after line 260:
$front_page_displays = (int) get_option( 'show_on_front' );
if($front_page_display == 'posts'){$home_page_id=0;}
This checks to make sure the first toggle is set to have page or posts on the front. If posts, then reset $home_page_id (page_for_posts) to 0 (value when drop down is set to "select").
I know there are possibly a few other locations you could add similar logic. I'm not sure what else the $home_page_id (page_for_posts) value would be used for.