_disable_content_editor_for_navigation_post_type

函数
_disable_content_editor_for_navigation_post_type ( $post )
Access
Private
参数
  • (WP_Post) $post An instance of WP_Post class.
    Required:
定义位置
相关方法
_enable_content_editor_for_navigation_post_type_disable_block_editor_for_navigation_post_typeuse_block_editor_for_post_typeblock_core_navigation_get_post_idsuse_block_editor_for_post
引入
5.9.0
弃用
-

_disable_content_editor_for_navigation_post_type: 这个函数用于禁用导航文章类型的内容编辑器: 这是为了保持对尚未过渡到使用区块编辑器的旧WordPress主题的向后兼容性。

这个回调可以禁用wp_navigation类型文章的内容编辑器。

内容编辑器不能正确处理wp_navigation类型的文章。
我们不能禁用wp_navigation的CPT定义中的”编辑器”功能,因为它禁用了通过REST API保存导航区块的权限。

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

常见问题

FAQs
查看更多 >