From b9dadf31a19c3fb6b391481b5fdde5984d8075ac Mon Sep 17 00:00:00 2001 From: isabel_brison Date: Tue, 11 Jul 2023 05:41:23 +0000 Subject: [PATCH] Editor: opt out of Navigation fallback. Allows developers to opt out of the auto-creation of the Navigation fallback through a filter. Props get_dave, spacedmonkey, ramonopoly. Fixes #58750. Built from https://develop.svn.wordpress.org/trunk@56202 git-svn-id: http://core.svn.wordpress.org/trunk@55714 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-navigation-fallback.php | 11 ++++++++++- wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-navigation-fallback.php b/wp-includes/class-wp-navigation-fallback.php index 6df4993a0f..c99b71a41a 100644 --- a/wp-includes/class-wp-navigation-fallback.php +++ b/wp-includes/class-wp-navigation-fallback.php @@ -26,9 +26,18 @@ class WP_Navigation_Fallback { */ public static function get_fallback() { + /** + * Filters whether or not a fallback should be created. + * + * @since 6.3.0 + * + * @param bool Whether to create a fallback navigation menu. Default true. + */ + $should_create_fallback = apply_filters( 'wp_navigation_should_create_fallback', true ); + $fallback = static::get_most_recently_published_navigation(); - if ( $fallback ) { + if ( $fallback || ! $should_create_fallback ) { return $fallback; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 329007d5cc..1ae51da389 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-beta3-56201'; +$wp_version = '6.3-beta3-56202'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.