How to disable Author dropdown in Gutenberg’s Status and Visibility panel

This has been present since before the block editor, and even the classic editor, and can be seen in WordPress 2.0. It even predates proper metaboxes!

In the block editor, the presence of the author field depends on wether the user has the action wp:action-assign-author, but there is no direct capability that determines this.

If we take a look at the authorship plugin we see that it can be removed:

/**
 * Filters the post data for a REST API response.
 *
 * This removes the `wp:action-assign-author` rel from the response so the default post author
 * control doesn't get shown on the block editor post editing screen.
 *
 * This also adds a new `authorship:action-assign-authorship` rel so custom clients can refer to this.
 *
 * @param WP_REST_Response $response The response object.
 * @param WP_Post          $post     Post object.
 * @param WP_REST_Request  $request  Request object.
 * @return WP_REST_Response The response object.
 */
function rest_prepare_post( WP_REST_Response $response, WP_Post $post, WP_REST_Request $request ) : WP_REST_Response {
    $links = $response->get_links();

    if ( isset( $links['https://api.w.org/action-assign-author'] ) ) {
        $response->remove_link( 'https://api.w.org/action-assign-author' );
        $response->add_link( REST_REL_LINK_ID, $links['self'][0]['href'] );
    }

    return $response;
}

So something like this might remove it for all users when editing posts:

/**
 * Filters the post data for a REST API response.
 *
 * This removes the `wp:action-assign-author` rel from the response so the default post author
 * control doesn't get shown on the block editor post editing screen.
 *
 * @param WP_REST_Response $response The response object.
 * @param WP_Post          $post     Post object.
 * @param WP_REST_Request  $request  Request object.
 * @return WP_REST_Response The response object.
 */
function rest_prepare_post_remove_author_action( WP_REST_Response $response, WP_Post $post, WP_REST_Request $request ) : WP_REST_Response {
    $links = $response->get_links();

    if ( isset( $links['https://api.w.org/action-assign-author'] ) ) {
        $response->remove_link( 'https://api.w.org/action-assign-author' );
    }

    return $response;
}
add_filter( 'rest_prepare_post', 'rest_prepare_post_remove_author_action', 10, 3 );

You may then adjust it to contain a role/capability check. Note that this may be purely cosmetic, users who directly make requests to the API, or use the classic editor, can still set the author.

This just fools the block editor and other well behaving REST API applications into believing it isn’t possible.