There are two options:
Easy (or without coding)
In short, make sure the page has a non-empty content.
-
Set the “Posts page” to none.
-
Edit the page you wanted to be the posts page and enter any content — even a space (
) would be sufficient. Save the page.
-
Now set the “Posts page” to the page you’ve just edited.
-
Edit that page and you should now see that the editor is enabled.
Why this works, is because the editor is only being disabled if the page content is empty (i.e. 0-length including spaces).
With custom code
One way is using the update_option_{option}
hook to set the post content to (a space) if the content is empty:
add_action( 'update_option_page_for_posts', function( $old_value, $new_value ){
$post = $new_value ? get_post( $new_value ) : null;
if ( $post && empty( $post->post_content ) ) {
wp_update_post( [
'ID' => $post->ID,
'post_content' => ' ', // or try using <!-- comment -->
] );
}
}, 10, 2 );
But first, set the “Posts page” to none; save the settings, then set the “Posts page” to the proper page. Because the hook (update_option_{option}
) won’t be fired if the option value is the same as the old one. (There are other hooks you can use/try, though.)