_disable_content_editor_for_navigation_post_type()WP 5.9.0

This callback disables the content editor for wp_navigation type posts. 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.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

null. Nothing (null).

Usage

_disable_content_editor_for_navigation_post_type( $post );
$post(WP_Post) (required)
An instance of WP_Post class.

Changelog

Since 5.9.0 Introduced.

_disable_content_editor_for_navigation_post_type() code WP 6.4.3

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' );
}