[wp-trac] [WordPress Trac] #56154: pre_get_posts fix to show menu on CPT Archives broken in 6.0
WordPress Trac
noreply at wordpress.org
Wed Jul 6 06:32:37 UTC 2022
#56154: pre_get_posts fix to show menu on CPT Archives broken in 6.0
------------------------------+------------------------------
Reporter: joshpaynedesigns | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 6.0
Severity: normal | Resolution:
Keywords: has-testing-info | Focuses:
------------------------------+------------------------------
Changes (by costdev):
* keywords: => has-testing-info
Comment:
== Testing Instructions
=== Steps to Reproduce
1. Activate a classic theme.
2. Add the following snippet to the classic theme's `functions.php` file:
{{{#!php
<?php
function fix_nav_menu( $query ) {
if ( $query->get( 'post_type' ) === 'nav_menu_item' ) {
$query->set( 'tax_query', '' );
$query->set( 'meta_key', '' );
$query->set( 'orderby', '' );
}
}
add_action( 'pre_get_posts', 'fix_nav_menu' );
}}}
3. Navigate to `Appearance > Menus`. If there aren't any existing menus,
create one, add "Sample Page" to it and save.
4. Create a second menu called "Test menu".
5. Add menu items to "Test menu" and click the `Save Menu` button.
6. 🐞 Once the menu has saved, menu items from the other menu are now
displayed in "Test menu".
7. Switch to the other menu.
8. 🐞 Menu items from "Test menu" are now displayed in this menu.
=== Expected Results
- ❌ Menu items from other menus are displayed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56154#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list