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
This commit is contained in:
isabel_brison 2023-07-11 05:41:23 +00:00
parent bf41190659
commit b9dadf31a1
2 changed files with 11 additions and 2 deletions

View File

@ -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;
}

View File

@ -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.