Created
November 3, 2020 11:00
-
-
Save nash-ye/a2b7e40eca0bbe4a0712bcae3d062bb9 to your computer and use it in GitHub Desktop.
Fixing WordPress Attachment Capabilities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'register_post_type_args', | |
function ($args, $postType) { | |
if ('attachment' === $postType) { | |
$args['capabilities']['edit_posts'] = 'upload_files'; | |
$args['capabilities']['upload_files'] = 'upload_files'; | |
} | |
return $args; | |
}, | |
15, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment