Some prefer to work with the visual editor when writing posts and others prefer the text editor. Change the default post editor by adding one of the following filters to your functions.php file:
// Visual editor as the default
add_filter( 'wp_default_editor', function () {
return 'tinymce';
} );
// Text (HTML) editor as the default
add_filter( 'wp_default_editor', function () {
return 'html';
} );
Use only one of the two. The filter sets which tab, Visual or Text, opens first in the classic editor, so it has no effect on the block editor. Older versions of this snippet used create_function(), which was removed in PHP 8.0 and now causes a fatal error.
For more editor configuration, see Enable Gutenberg for Custom Post Types.