Unload WP editor loaded by another plugin
[MAILPOET-2105]
This commit is contained in:
@ -51,6 +51,13 @@ class ConflictResolver {
|
||||
'resolveScriptsConflict',
|
||||
]
|
||||
);
|
||||
WPFunctions::get()->addAction(
|
||||
'mailpoet_conflict_resolver_scripts',
|
||||
[
|
||||
$this,
|
||||
'resolveEditorConflict',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
function resolveRouterUrlQueryParametersConflict() {
|
||||
@ -117,4 +124,30 @@ class ConflictResolver {
|
||||
WPFunctions::get()->addAction('admin_print_scripts', $dequeue_scripts, $execute_first);
|
||||
WPFunctions::get()->addAction('admin_print_footer_scripts', $dequeue_scripts, $execute_first);
|
||||
}
|
||||
|
||||
function resolveEditorConflict() {
|
||||
|
||||
// mark editor as already enqueued to prevent loading its assets
|
||||
// when wp_enqueue_editor() used by some other plugin
|
||||
global $wp_actions;
|
||||
$wp_actions['wp_enqueue_editor'] = 1;
|
||||
|
||||
// prevent editor loading when used wp_editor() used by some other plugin
|
||||
WPFunctions::get()->addFilter('wp_editor_settings', function () {
|
||||
ob_start();
|
||||
return [
|
||||
'tinymce' => false,
|
||||
'quicktags' => false,
|
||||
];
|
||||
});
|
||||
|
||||
WPFunctions::get()->addFilter('the_editor', function () {
|
||||
return '';
|
||||
});
|
||||
|
||||
WPFunctions::get()->addFilter('the_editor_content', function () {
|
||||
ob_end_clean();
|
||||
return '';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user