@azaozz,
Would it be easier to just have the ability on the network settings page to change the defaults network wide?
@azaozz
This is pretty much how it works now too.
I disagree. On a network with hundreds of sites, it’s pretty much impossible to go into each site and then set the default to Block Editor manually. Plus, each new site will still have the Classic Editor as the default.
Like @chaplina and @verdonv I think a network option to set the default to Block Editor would be the best solution. But in absence of that option, allowing site-per-site activation is the next best solution…
@chaplina, thanks for sharing 🙂 Starting from that, I can try to create a network option.
@azaozz would you consider merging a PR with a network option to set the default to Block Editor?
would you consider merging a PR with a network option to set the default to Block Editor
Sure, we can add another setting on the “network settings” screen, should be pretty straightforward. Something like:
Network Default Editor (o) Block Editor
(o) Classic Editor
For now there is a filter that’s super easy to use 🙂
Just add this to a file in the mu-plugins directory:
add_filter( 'classic_editor_network_default_settings', 'my_func' );
function my_func() {
return array( 'editor' => 'block', 'allow-users' => false );
}
-
This reply was modified 5 years, 4 months ago by Andrew Ozz.
@chaplina could you test this version on https://github.com/RavanH/classic-editor ? Use green button on the right > download zip, then extract and upload file classic-editor.php (only one modified) via FTP
There is a new option on the Network Admin > Settings 🙂
Tested and works. We’ll need to collaborate with the Divi folks.
This is the PHP error generated if Classic Editor plugin is network activated with the Block editor as the default:
FastCGI sent in stderr: “PHP message: PHP Notice: edit_form_advanced is deprecated since version 5.0.0! Use block_editor_meta_box_hidden_fields instead. This action is still supported in the classic editor, but is deprecated in the block editor.
@chaplina thanks for testing and feedback 🙂
The edit_form_advanced notice must be triggered by some other plugin/theme.
For Divi specific sites on your multisite, you could use the filter suggested by @azaozz like this (I’m supposing Divi is simply called “Divi” here, if not, change that):
add_filter( 'classic_editor_network_default_settings', 'classic_for_divi' );
function classic_for_divi( $defaults ) {
$theme = wp_get_theme();
if ( 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ) {
return array( 'editor' => 'classic', 'allow-users' => false, 'hide-settings-ui' => true );
}
return $defaults;
}
Untested but 'hide-settings-ui' => true
should prevent site owners to accidentally activate the block editor if “allow site admins to change settings” is enabled…
Yep, can use classic_editor_network_default_settings
to set the default per site. That will be overridden by site admins if the “Allow site admins…” checkbox is checked.
Another filter to override how the plugin works per site, per user, per post_type, etc. is classic_editor_plugin_settings
. See https://github.com/WordPress/classic-editor/blob/master/classic-editor.php#L178. Using that may be better in this case.