admin管理员组文章数量:1133915
I use the admin menu editor plugin. I have not allowed editors and authors to access the tags section
But they can add a new tag in the post edit section This is not good for our site
We want them to only use tags that have already been created
Is there a way to disable adding new tags on the edit and add post, by editors and authors?
I use the admin menu editor plugin. I have not allowed editors and authors to access the tags section
But they can add a new tag in the post edit section This is not good for our site
We want them to only use tags that have already been created
Is there a way to disable adding new tags on the edit and add post, by editors and authors?
Share Improve this question edited Sep 23, 2023 at 14:36 Ali Kiani asked Sep 22, 2023 at 19:06 Ali KianiAli Kiani 335 bronze badges1 Answer
Reset to default 1A CSS rule would be the simple action.
You can just create a single global admin area foot script set of instructions and disable a whole series of elements by user capability and simply add instructions as needed, and affect all areas of the admin area.
functions.php or create a plugin that would give flexibility to be used on any WP site without dependence on specific theme.
add_action('admin_print_footer_scripts', function() {
## block fields from non admins
// set default empty vars
$non_admin_css_blocks= $non_admin_js_blocks='';
// user condition check
if( !current_user_can('manage_options') ) {
$non_admin_blocks = '
#post_tag .jaxtag,
.other-field,
.another-field {display: none !important;}
';
// javascript instructions
$non_admin_js_blocks = '
$("#post-body #title,#edit-slug-box button.edit-slug").attr("disabled","disabled");
';
}
$css = '
<style>
'.$non_admin_blocks.'
</style>
';
$js = '
<script>
jQuery(function($) {
'.$non_admin_js_blocks.'
});
</script>
';
echo $css . $js;
});
Note
You can always scan the files in wp-admin to find all the hooks that will deliver any alteration desired. Just search for do_action
or apply_filters
and read the commented tip to determine firing time and behavior. If a hook has a variable, that will be used in the callback argument. If there are multiple vars you will need to define the count. EG
priority 10,args count 2
add_action('do_something_different', function($alt,$target) {
}10,2);
本文标签: user rolesdisable adding new tags on the edit and add post
版权声明:本文标题:user roles - disable adding new tags on the edit and add post 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736791024a1953088.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论