Remove add post for user role

This is not possible using the capabilities system, the granularity you want does not exist in WP core:

edit_posts

  • Since 2.0
  • Allows access to Administration Screens options:
    • Posts
    • Posts > Add New
    • Comments
    • Comments > Awaiting Moderation

https://wordpress.org/support/article/roles-and-capabilities/#edit_posts

edit_posts covers both viewing, adding, and editing posts, as well as commenting. There is a capability that controls wether you can edit other peoples posts however, but that isn’t what you asked for.

Internally, the lowest abstraction before we get to raw SQL is wp_insert_post, which handles both post creation, and post updating. The only difference between creating a post and editing a post is wether a post ID is in the array passed to wp_insert_post ( wp_update_post is just a wrapper around wp_insert_post )

error code: 523