如果你想禁用某种自定义文章类型的可视化编辑器,可以将下面的代码添加到主题的 functions.php 即可:
/** * WordPress 禁用<a href="https://www.wpdaxue.com/tag/%e8%87%aa%e5%ae%9a%e4%b9%89%e6%96%87%e7%ab%a0%e7%b1%bb%e5%9e%8b" title="查看与【自定义文章类型】相关的文章" target="_blank" rel="noopener">自定义文章类型</a>的可视化编辑器 * https://www.wpdaxue.com/disable-wysiwyg-editor-for-custom-post-types.html */ add_filter( 'user_can_richedit', 'disable_wysiwyg_editor_for_cpt' ); function disable_wysiwyg_editor_for_cpt( $default ) { global $post; if ( get_post_type( $post ) == 'question') // 请修改 question 为你的文章类型 return false; return $default; } |
请根据自己的实际,修改代码的第 8 行的文章类型。
来源:
https://www.wpdaxue.com/disable-wysiwyg-editor-for-custom-post-types.html