禁用后端的“查看”提法?

时间:2015-03-06 作者:Daniele Chianucci

I\'m using wordpress as a content manager or something, so i\'m using backend only (and i\'ve disabled the frontend with a ghost theme which redirect to the admin panel).

The question is: how could i disable the "view" post button and generally every mention to "preview" posts, view categoryes, pages etc?

enter image description here

Solved!

Thank you cristian.raiber! It worked perfectly. I\'ve also put this lines to hide the previews in single posts:


function posttype_admin_css() {
global $post_type;
$post_types = array(
                        /* set post types */ 
                        \'progetti\',
                        \'post\',
                        \'page\',
                  );
    if(in_array($post_type, $post_types))
    echo \'#post-preview, #view-post-btn{display: none;}\';
}
add_action( \'admin_head-post-new.php\', \'posttype_admin_css\' );
add_action( \'admin_head-post.php\', \'posttype_admin_css\' );

add_action(\'admin_head\', \'hide_quick_view\');

function hide_quick_view() { echo \' span.view {display: none !important; visibility: hidden !important; opacity: 0 !important;} \'; }

1 个回复
最合适的回答,由SO网友:cristian.raiber 整理而成

与其禁用它,不如使用一些CSS技巧来隐藏它。

试试这个,让我知道它是否有效:

    add_action(\'admin_head\', \'hide_quick_view\');

function hide_quick_view() {
  echo \'<style>
    span.view {display: none !important; visibility: hidden !important; opacity: 0 !important;}
  </style>\';
}
这应该放在您的函数中。php文件。

结束