如果你想禁用某种自定义文章类型的可视化编辑器,可以将下面的代码添加到主题的 functions.php 即可:
1 2 3 4 5 6 7 8 9 10 11 |
/** * WordPress 禁用自定义文章类型的可视化编辑器 * 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; } |
/**
* WordPress 禁用自定义文章类型的可视化编辑器
* 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 行的文章类型。
RSS