_disable_content_editor_for_navigation_post_type( WP_Post $post )

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

This callback disables the content editor for wp_navigation type posts.

Description

Content editor cannot handle wp_navigation type posts correctly.
We cannot disable the "editor" feature in the wp_navigation’s CPT definition because it disables the ability to save navigation blocks via REST API.

Parameters

$postWP_Postrequired
An instance of WP_Post class.

Source

function _disable_content_editor_for_navigation_post_type( $post ) {
	$post_type = get_post_type( $post );
	if ( 'wp_navigation' !== $post_type ) {
		return;
	}

	remove_post_type_support( $post_type, 'editor' );
}

Changelog

VersionDescription
5.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.