WordPress基于ID隐藏页面编辑器?
是否仍然可以根据页面ID在页面上隐藏post editor wysiwyg 我有一些自定义元框,不需要在这个特定的页面上 我已经尝试了以下内容,但它没有做任何事情,该页面的id为75,但它仍然显示WordPress基于ID隐藏页面编辑器?,wordpress,Wordpress,是否仍然可以根据页面ID在页面上隐藏post editor wysiwyg 我有一些自定义元框,不需要在这个特定的页面上 我已经尝试了以下内容,但它没有做任何事情,该页面的id为75,但它仍然显示 function remove_pages_editor(){ if(get_the_ID() == 75) { remove_post_type_support( 'post', 'editor' ); } // end if } // end remove_pages_edit
function remove_pages_editor(){
if(get_the_ID() == 75) {
remove_post_type_support( 'post', 'editor' );
} // end if
} // end remove_pages_editor
add_action( 'add_meta_boxes', 'remove_pages_editor' );
有什么想法吗?这可以用以前的钩子来完成
哦,我是作为一个。。。刚刚检查过,它既不能作为普通插件使用,也不能在
functions.php
中使用。更新了答案。My bad,在我的测试中,它作为普通插件和mu插件在functions.php
中工作。我重新检查了错误的ID,因此我感到困惑。您需要定位的屏幕是/wp admin/post.php?post=75&action=edit
?::如果可以,请尝试禁用所有插件并切换到TwentyEleven以查看是否存在冲突…仍然不起作用,它适用于页面模板,使用此功能可以编辑页面id吗?如果您将删除发布类型支持(…)
>更改为echo'#postdivrich{display:none!important;}则有效代码>。它不会删除编辑器,而是隐藏它。快速修复。
add_action( 'load-post.php', 'hide_specific_editor_so_15154969' );
function hide_specific_editor_so_15154969()
{
if( '75' == $_GET['post'] && 'edit' == $_GET['action'] )
remove_post_type_support( 'post', 'editor' );
}