diff --git a/lib/navigation.php b/lib/navigation.php index 8a3587ae7dff12..78ea46e8c95c35 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -386,3 +386,36 @@ function gutenberg_parse_blocks_from_menu_items( $menu_items, $menu_items_by_par return $blocks; } + +/** + * Shim that hides ability to edit visibility and status for wp_navigation type posts. + * When merged to Core, the CSS below should be moved to wp-admin/css/edit.css. + * + * This shim can be removed when the Gutenberg plugin requires a WordPress + * version that has the ticket below. + * + * @see https://core.trac.wordpress.org/ticket/54407 + * + * @param string $hook The current admin page. + */ +function gutenberg_hide_visibility_and_status_for_navigation_posts( $hook ) { + $allowed_hooks = array( 'post.php', 'post-new.php' ); + if ( ! in_array( $hook, $allowed_hooks, true ) ) { + return; + } + + /** + * HACK: We're hiding the description field using CSS because this + * cannot be done using a filter or an action. + */ + + $css = <<