WP_Navigation_Fallback::create_default_fallback()private staticWP 6.3.0

Creates a default Navigation Block Menu fallback.

Метод класса: WP_Navigation_Fallback{}

Хуков нет.

Возвращает

int|WP_Error. The post ID of the default fallback menu or a WP_Error object.

Использование

$result = WP_Navigation_Fallback::create_default_fallback();

Список изменений

С версии 6.3.0 Введена.

Код WP_Navigation_Fallback::create_default_fallback() WP 6.6.2

private static function create_default_fallback() {

	$default_blocks = static::get_default_fallback_blocks();

	// Create a new navigation menu from the fallback blocks.
	$default_fallback = wp_insert_post(
		array(
			'post_content' => $default_blocks,
			'post_title'   => _x( 'Navigation', 'Title of a Navigation menu' ),
			'post_name'    => 'navigation',
			'post_status'  => 'publish',
			'post_type'    => 'wp_navigation',
		),
		true // So that we can check whether the result is an error.
	);

	return $default_fallback;
}