Skip to content

Commit

Permalink
Editor: Remove Navigation Areas
Browse files Browse the repository at this point in the history
Navigation area were merged as part of full site editing and the new navigation block. This functionality is experimental and not currently used in WordPress core, so should be removed.

Props noisysocks, spacedmonkey, get_dave, zieladam.
Fixes #54506.


Built from https://develop.svn.wordpress.org/trunk@52272


git-svn-id: http://core.svn.wordpress.org/trunk@51864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
spacedmonkey committed Nov 29, 2021
1 parent 31a76e5 commit ebf7eb5
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 650 deletions.
9 changes: 0 additions & 9 deletions wp-admin/site-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,8 @@ static function( $classes ) {
'/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit',
'/wp/v2/global-styles/' . $active_global_styles_id,
'/wp/v2/themes/' . $active_theme . '/global-styles',
'/wp/v2/block-navigation-areas?context=edit',
);

$areas = get_option( 'wp_navigation_areas', array() );
$active_areas = array_intersect_key( $areas, get_navigation_areas() );
foreach ( $active_areas as $post_id ) {
if ( $post_id ) {
$preload_paths[] = add_query_arg( 'context', 'edit', rest_get_route_for_post( $post_id ) );
}
}

block_editor_rest_api_preload( $preload_paths, $block_editor_context );

wp_add_inline_script(
Expand Down
1 change: 0 additions & 1 deletion wp-includes/blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
require ABSPATH . WPINC . '/blocks/latest-posts.php';
require ABSPATH . WPINC . '/blocks/legacy-widget.php';
require ABSPATH . WPINC . '/blocks/loginout.php';
require ABSPATH . WPINC . '/blocks/navigation-area.php';
require ABSPATH . WPINC . '/blocks/navigation-link.php';
require ABSPATH . WPINC . '/blocks/navigation-submenu.php';
require ABSPATH . WPINC . '/blocks/navigation.php';
Expand Down
22 changes: 0 additions & 22 deletions wp-includes/blocks/navigation-area.php

This file was deleted.

27 changes: 0 additions & 27 deletions wp-includes/blocks/navigation-area/block.json

This file was deleted.

8 changes: 0 additions & 8 deletions wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,6 @@ function render_block_core_navigation( $attributes, $content, $block ) {
$inner_blocks = new WP_Block_List( $parsed_blocks, $attributes );
}

if ( ! empty( $block->context['navigationArea'] ) ) {
$area = $block->context['navigationArea'];
$mapping = get_option( 'wp_navigation_areas', array() );
if ( ! empty( $mapping[ $area ] ) ) {
$attributes['navigationMenuId'] = $mapping[ $area ];
}
}

// Load inner blocks from the navigation post.
if ( array_key_exists( 'navigationMenuId', $attributes ) ) {
$navigation_post = get_post( $attributes['navigationMenuId'] );
Expand Down
4 changes: 0 additions & 4 deletions wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,4 @@
add_action( 'wp_footer', 'the_block_template_skip_link' );
add_action( 'setup_theme', 'wp_enable_block_templates' );

// Navigation areas.
add_action( 'setup_theme', '_wp_register_default_navigation_areas' );
add_action( 'switch_theme', '_wp_migrate_menu_to_navigation_post', 99, 3 );

unset( $filter, $action );
262 changes: 0 additions & 262 deletions wp-includes/navigation-areas.php

This file was deleted.

4 changes: 0 additions & 4 deletions wp-includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,6 @@ function create_initial_rest_routes() {
// Menu Locations.
$controller = new WP_REST_Menu_Locations_Controller();
$controller->register_routes();

// Block Navigation Areas
$controller = new WP_REST_Block_Navigation_Areas_Controller();
$controller->register_routes();
}

/**
Expand Down
Loading

0 comments on commit ebf7eb5

Please sign in to comment.