Bird
0
0

You want to create a custom role that can only read content and upload files but cannot publish posts. Which capability array is correct for add_role()?

hard📝 Application Q8 of 15
Wordpress - WordPress Settings and Configuration
You want to create a custom role that can only read content and upload files but cannot publish posts. Which capability array is correct for add_role()?
Aarray( 'read' => true, 'upload_files' => true, 'publish_posts' => true )
Barray( 'read' => true, 'publish_posts' => false )
Carray( 'read' => true, 'upload_files' => true )
Darray( 'read' => true )
Step-by-Step Solution
Solution:
  1. Step 1: Understand capability assignment in add_role()

    Only capabilities set to true are granted; false or missing means no permission.
  2. Step 2: Select capability array granting read and upload_files only

    array( 'read' => true, 'upload_files' => true ) grants read and upload_files; publish_posts is not included, so denied.
  3. Final Answer:

    array( 'read' => true, 'upload_files' => true ) -> Option C
  4. Quick Check:

    Grant only needed capabilities, omit or exclude others [OK]
Quick Trick: Only include true capabilities to grant permissions [OK]
Common Mistakes:
  • Setting false disables capability explicitly
  • Including publish_posts grants permission
  • Confusing capability keys

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes