删除没有插件的添加新页面 [英] remove the add new page with no plugins
问题描述
我想删除用户在 wordpress 中添加新页面的能力.但 sill 可以编辑它们.
i want to remove users the ability to add new pages in wordpress. but sill can edit them.
我正在使用会员插件,但对他们来说要么全有要么全无.我可以隐藏所有页面(包括编辑和阅读功能).我已经尝试了一些更大的插件如何做同样的事情.所以我想写我的代码.
im using Members plugin but for them its all or nothing. i can hide all of the Pages (including the edit and reading capabilities). i have tried a few more big plugins how do the same. so i want to write my on code.
我找到了一些帮助,但只解决了部分问题
i have found some help but for only part of the problem
例如,此代码仅删除侧门,但不删除 wp-admin/edit.php?post_type=page 页面中的添加新按钮或在上层菜单
for example this code remove only the sidemen but dont remove the add new button in the wp-admin/edit.php?post_type=page page or in the upper menu
function disable_new_pages() {
// Hide sidebar link
global $submenu;
unset($submenu['edit.php?post_type=page'][10]);
// Hide link on listing page
if (isset($_GET['post_type']) && $_GET['post_type'] == 'page') {
echo '<style type="text/css">
#favorite-actions, .add-new-h2, .tablenav { display:none; }
</style>';
}
}
add_action('admin_menu', 'disable_new_pages');
我怎样才能彻底删除它
推荐答案
function hide_add_new_page_button(){
echo ('<style>a[href~="post-new.php?post_type=page"], .page-title-action { display: none !important; }</style>');
}
add_action('admin_head','hide_add_new_page_button');
这篇关于删除没有插件的添加新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!