mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Menus: Do not show trashed posts in nav menus.
Trashed posts cannot be accessed by site visitors and thus should not be visible on the front end. By marking menu items of trashed posts as invalid, they are excluded from the output. Props solarissmoke, swissspidy. Fixes #19038. Built from https://develop.svn.wordpress.org/trunk@38744 git-svn-id: http://core.svn.wordpress.org/trunk@38687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7c994d1bf
commit
ff411ed5f4
@ -747,6 +747,10 @@ function wp_setup_nav_menu_item( $menu_item ) {
|
||||
$menu_item->_invalid = true;
|
||||
}
|
||||
|
||||
if ( 'trash' === get_post_status( $menu_item->object_id ) ) {
|
||||
$menu_item->_invalid = true;
|
||||
}
|
||||
|
||||
$menu_item->url = get_permalink( $menu_item->object_id );
|
||||
|
||||
$original_object = get_post( $menu_item->object_id );
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38743';
|
||||
$wp_version = '4.7-alpha-38744';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user