简体   繁体   English

wp功能编辑自己的附件

[英]wp capabilities edit own attachments

In my WordPress System I have two users - admin, id 1 - editor, id 2 在我的WordPress系统中,我有两个用户-管理员,ID 1-编辑器,ID 2

If admin upload a file, admin and editor are able to edit the attachment, change fields like description 如果管理员上传文件,则管理员和编辑者可以编辑附件,更改说明等字段

If editor uploads a file, neither admin nor editor are able to edit the attachment. 如果编辑者上传文件,则管理员和编辑者均无法编辑附件。

If I change the post_author in the database to "1", admin and editor are able to change the attachment??? 如果我将数据库中的post_author更改为“ 1”,则admin和editor可以更改附件???

I set the following capabilities in the functions.php Theme file: 我在functions.php主题文件中设置了以下功能:

$role = get_role('editor');
$role->remove_cap('edit_posts');
$role->remove_cap('moderate_comments');
$role->remove_cap('manage_categories');
$role->remove_cap('manage_tags');
$role->remove_cap('delete_pages');
$role->remove_cap('delete_others_pages');
$role->remove_cap('delete_published_pages');

Remove this 删除这个

$role->remove_cap('edit_posts');

You can update the capabilities using this 您可以使用此更新功能

$role->add_cap( 'edit_post' );

See here . 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM