如果你想禁用某种自定义文章类型的可视化编辑器,可以将下面的代码添加到主题的 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;
} |
/**
* 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
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32421.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57