Skip to content

Commit 99f5532

Browse files
committed
fix: 修復知識庫沒有選種預設版型的問題
1 parent 38fea44 commit 99f5532

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

inc/classes/Domains/Doc/Api.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ public static function extend_post_meta_keys( array $meta_keys, \WP_Post $post )
6666
}
6767

6868
// 設定預設 editor
69-
$editor = \get_post_meta( $post->ID, 'editor', true ) ?: 'power-editor';
69+
$editor = \get_post_meta( $post->ID, 'editor', true );
70+
// 如果是沒有 post_parent ,那麼此 $post 就是知識庫, editor 如果為 '' 代表為預設版型,不需要預設為 'power-editor'
71+
// 有 post_parent ,代表是章節/子文章,那麼 editor ,需要為 'power-editor'
72+
if ($post->post_parent) {
73+
$editor = $editor ?: 'power-editor';
74+
}
7075
$meta_keys['editor'] = $editor;
7176

7277
// 只有頂層需要 bg_images

0 commit comments

Comments
 (0)