_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
檢視更多 >